VLC 4.0.0-dev
Loading...
Searching...
No Matches
Collaboration diagram for Interruptible sleep functions:

Functions

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

Detailed Description

Function Documentation

◆ vlc_accept_i11e()

int vlc_accept_i11e ( int  fd,
struct sockaddr *  addr,
socklen_t *  addrlen,
bool  nonblock 
)

References POLLIN, vlc_accept(), and vlc_poll_sock().

◆ vlc_interrupt_register()

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()

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()

int vlc_mwait_i11e ( vlc_tick_t  deadline)

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()

int vlc_poll_i11e ( struct pollfd fds,
unsigned  nfds,
int  timeout 
)

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_poll_file(), vlc_tls_ClientSessionCreate(), vlc_tls_Read(), vlc_tls_WaitConnect(), and vlc_tls_Write().

◆ vlc_read_i11e()

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()

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::fd, POLLIN, readv(), and vlc_poll_file().

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()

ssize_t vlc_recvfrom_i11e ( int  fd,
void *  buf,
size_t  len,
int  flags,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

References vlc_recvmsg_i11e().

Referenced by vlc_recv_i11e().

◆ vlc_recvmsg_i11e()

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

References POLLIN, recvmsg(), and vlc_poll_sock().

Referenced by vlc_recvfrom_i11e().

◆ vlc_sem_wait_i11e()

int vlc_sem_wait_i11e ( vlc_sem_t sem)

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(), and vlc::threads::semaphore::wait_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()

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

References POLLOUT, vlc_poll_sock(), and vlc_sendmsg().

Referenced by vlc_sendto_i11e().

◆ vlc_sendto_i11e()

ssize_t vlc_sendto_i11e ( int  fd,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  addr,
socklen_t  addrlen 
)

References vlc_sendmsg_i11e().

Referenced by vlc_send_i11e().

◆ vlc_write_i11e()

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()

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::fd, POLLOUT, vlc_poll_file(), and vlc_writev().

Referenced by vlc_write_i11e().