VLC  4.0.0-dev
Functions
Collaboration diagram for Interruptible sleep functions:

Functions

VLC_EXPORT int vlc_sem_wait_i11e (vlc_sem_t *)
 Interruptible variant of vlc_sem_wait(). More...
 
VLC_EXPORT int vlc_mwait_i11e (vlc_tick_t)
 Interruptible variant of vlc_tick_wait(). More...
 
static int vlc_msleep_i11e (vlc_tick_t delay)
 Interruptible variant of vlc_tick_sleep(). More...
 
VLC_EXPORT int vlc_poll_i11e (struct pollfd *, unsigned, int)
 Interruptible variant of poll(). More...
 
VLC_EXPORT ssize_t vlc_readv_i11e (int fd, struct iovec *, int)
 Wrapper for readv() that returns the EINTR error upon VLC I/O interruption. More...
 
VLC_EXPORT ssize_t vlc_writev_i11e (int fd, const struct iovec *, int)
 Wrapper for writev() that returns the EINTR error upon VLC I/O interruption. More...
 
VLC_EXPORT ssize_t vlc_read_i11e (int fd, void *, size_t)
 Wrapper for read() that returns the EINTR error upon VLC I/O interruption. More...
 
VLC_EXPORT ssize_t vlc_write_i11e (int fd, const void *, size_t)
 Wrapper for write() that returns the EINTR error upon VLC I/O interruption. More...
 
VLC_EXPORT ssize_t vlc_recvmsg_i11e (int fd, struct msghdr *, int flags)
 
VLC_EXPORT ssize_t vlc_sendmsg_i11e (int fd, const struct msghdr *, int flags)
 
VLC_EXPORT ssize_t vlc_recvfrom_i11e (int fd, void *, size_t, int flags, struct sockaddr *, socklen_t *)
 
VLC_EXPORT ssize_t vlc_sendto_i11e (int fd, const void *, size_t, int flags, const struct sockaddr *, socklen_t)
 
static ssize_t vlc_recv_i11e (int fd, void *buf, size_t len, int flags)
 
static ssize_t vlc_send_i11e (int fd, const void *buf, size_t len, int flags)
 
VLC_EXPORT int vlc_accept_i11e (int fd, struct sockaddr *, socklen_t *, bool)
 
VLC_EXPORT void vlc_interrupt_register (void(*cb)(void *), void *opaque)
 Registers a custom interrupt handler. More...
 
VLC_EXPORT int vlc_interrupt_unregister (void)
 

Detailed Description

Function Documentation

◆ vlc_accept_i11e()

VLC_EXPORT int vlc_accept_i11e ( int  fd,
struct sockaddr *  ,
socklen_t *  ,
bool   
)

◆ vlc_interrupt_register()

VLC_EXPORT void vlc_interrupt_register ( void(*)(void *)  cb,
void *  opaque 
)

Registers a custom interrupt handler.

Registers a custom callback as interrupt handler for the calling thread. The callback must be unregistered with vlc_interrupt_unregister() before thread termination and before any further callback registration.

If the calling thread has no interruption context, this function has no effects.

References vlc_interrupt_prepare(), and vlc_interrupt_var.

Referenced by dialog_wait(), FinderThread(), InstallerThread(), and vlc_h2_stream_lock().

◆ vlc_interrupt_unregister()

VLC_EXPORT int vlc_interrupt_unregister ( void  )

◆ vlc_msleep_i11e()

static int vlc_msleep_i11e ( vlc_tick_t  delay)
inlinestatic

Interruptible variant of vlc_tick_sleep().

Waits for a specified timeout duration or, if the calling thread has an interruption context, an interruption.

Parameters
delaytimeout value (in microseconds)
Returns
EINTR if an interruption occurred, otherwise 0 once the timeout expired.

References vlc_mwait_i11e(), and vlc_tick_now().

◆ vlc_mwait_i11e()

VLC_EXPORT int vlc_mwait_i11e ( vlc_tick_t  )

Interruptible variant of vlc_tick_wait().

Waits for a specified timestamp or, if the calling thread has an interruption context, an interruption.

Returns
EINTR if an interruption occurred, otherwise 0 once the timestamp is reached.

References vlc_interrupt::interrupted, vlc_interrupt::lock, vlc_cleanup_pop, vlc_cleanup_push, vlc_cond_init(), vlc_cond_timedwait(), vlc_interrupt_finish(), vlc_interrupt_prepare(), vlc_interrupt_var, vlc_mutex_lock(), vlc_mutex_unlock(), vlc_mwait_i11e_cleanup(), vlc_mwait_i11e_wake(), and vlc_tick_wait.

Referenced by vlc_msleep_i11e().

◆ vlc_poll_i11e()

VLC_EXPORT int vlc_poll_i11e ( struct pollfd ,
unsigned  ,
int   
)

Interruptible variant of poll().

Waits for file descriptors I/O events, a timeout, a signal or a VLC I/O interruption. Except for VLC I/O interruptions, this function behaves just like the standard poll().

Note
This function is always a cancellation point (as poll()).
See also
poll() manual page
Parameters
fdstable of events to wait for
nfdsnumber of entries in the table
timeouttime to wait in milliseconds or -1 for infinite
Returns
A strictly positive result represent the number of pending events. 0 is returned if the time-out is reached without events. -1 is returned if a VLC I/O interrupt occurs (and errno is set to EINTR) or if an error occurs.

References likely, poll(), unlikely, vlc_alloc(), vlc_cleanup_pop, vlc_cleanup_push, vlc_interrupt_var, and vlc_poll_i11e_inner().

Referenced by net_Connect(), vlc_accept_i11e(), vlc_readv_i11e(), vlc_recvmsg_i11e(), vlc_sendmsg_i11e(), vlc_tls_ClientSessionCreate(), vlc_tls_Read(), vlc_tls_WaitConnect(), vlc_tls_Write(), and vlc_writev_i11e().

◆ vlc_read_i11e()

VLC_EXPORT ssize_t vlc_read_i11e ( int  fd,
void *  buf,
size_t  count 
)

Wrapper for read() that returns the EINTR error upon VLC I/O interruption.

Warning
This function ignores the non-blocking file flag.

References count, and vlc_readv_i11e().

◆ vlc_readv_i11e()

VLC_EXPORT ssize_t vlc_readv_i11e ( int  fd,
struct iovec *  iov,
int  count 
)

Wrapper for readv() that returns the EINTR error upon VLC I/O interruption.

Warning
This function ignores the non-blocking file flag.

References count, pollfd::events, pollfd::fd, POLLIN, and vlc_poll_i11e().

Referenced by vlc_read_i11e().

◆ vlc_recv_i11e()

static ssize_t vlc_recv_i11e ( int  fd,
void *  buf,
size_t  len,
int  flags 
)
inlinestatic

References vlc_recvfrom_i11e().

Referenced by net_Read().

◆ vlc_recvfrom_i11e()

VLC_EXPORT ssize_t vlc_recvfrom_i11e ( int  fd,
void *  ,
size_t  ,
int  flags,
struct sockaddr *  ,
socklen_t *   
)

References vlc_recvmsg_i11e().

Referenced by vlc_recv_i11e().

◆ vlc_recvmsg_i11e()

VLC_EXPORT ssize_t vlc_recvmsg_i11e ( int  fd,
struct msghdr *  ,
int  flags 
)

◆ vlc_sem_wait_i11e()

VLC_EXPORT int vlc_sem_wait_i11e ( vlc_sem_t )

Interruptible variant of vlc_sem_wait().

Waits on a semaphore like vlc_sem_wait(). If the calling thread has an interruption context (as set by vlc_interrupt_set()), and another thread invokes vlc_interrupt_raise() on that context, the semaphore is incremented.

Warning
The calling thread should be the only thread ever to wait on the specified semaphore. Otherwise, interruptions may not be delivered accurately (the wrong thread may be woken up).
Note
This function is (always) a cancellation point.
Returns
EINTR if the semaphore was incremented due to an interruption, otherwise zero.

References vlc_cleanup_pop, vlc_cleanup_push, vlc_interrupt_cleanup(), vlc_interrupt_finish(), vlc_interrupt_prepare(), vlc_interrupt_sem(), vlc_interrupt_var, and vlc_sem_wait().

Referenced by vlc_getaddrinfo_i11e().

◆ vlc_send_i11e()

static ssize_t vlc_send_i11e ( int  fd,
const void *  buf,
size_t  len,
int  flags 
)
inlinestatic

References vlc_sendto_i11e().

Referenced by net_Write().

◆ vlc_sendmsg_i11e()

VLC_EXPORT ssize_t vlc_sendmsg_i11e ( int  fd,
const struct msghdr *  ,
int  flags 
)

◆ vlc_sendto_i11e()

VLC_EXPORT ssize_t vlc_sendto_i11e ( int  fd,
const void *  ,
size_t  ,
int  flags,
const struct sockaddr *  ,
socklen_t   
)

References vlc_sendmsg_i11e().

Referenced by vlc_send_i11e().

◆ vlc_write_i11e()

VLC_EXPORT ssize_t vlc_write_i11e ( int  fd,
const void *  buf,
size_t  count 
)

Wrapper for write() that returns the EINTR error upon VLC I/O interruption.

Note
Like write(), once some but not all bytes are written, the function might wait for write completion, regardless of signals and interruptions.
Warning
This function ignores the non-blocking file flag.

References count, and vlc_writev_i11e().

◆ vlc_writev_i11e()

VLC_EXPORT ssize_t vlc_writev_i11e ( int  fd,
const struct iovec *  iov,
int  count 
)

Wrapper for writev() that returns the EINTR error upon VLC I/O interruption.

Note
Like writev(), once some but not all bytes are written, the function might wait for write completion, regardless of signals and interruptions.
Warning
This function ignores the non-blocking file flag.

References count, pollfd::events, pollfd::fd, POLLOUT, and vlc_poll_i11e().

Referenced by vlc_write_i11e().