pth_accept, pth_connect, pth_read, pth_write, pth_sleep, pth_millisleep, pth_nanosleep, pth_timeout - pseudothread system calls |
#include <pthr_pseudothread.h> int pth_accept (pseudothread, int, struct sockaddr *, int *); int pth_connect (pseudothread, int, struct sockaddr *, int); ssize_t pth_read (pseudothread, int, void *, size_t); ssize_t pth_write (pseudothread, int, const void *, size_t); int pth_sleep (pseudothread, int seconds); int pth_millisleep (pseudothread, int millis); int pth_nanosleep (pseudothread, const struct timespec *req, struct timespec *rem); void pth_timeout (pseudothread, int seconds); |
pth_accept, pth_connect, pth_read, pth_write, pth_sleep and pth_nanosleep behave just like the corresponding system calls. However these calls handle non-blocking sockets and cause the thread to sleep on the reactor if it would block. For general I/O you will probably wish to wrap up your sockets in I/O handle objects, which give you a higher-level buffered interface to sockets (see io_fdopen(3)). |
pth_millisleep sleeps for a given number of milliseconds. |
pth_timeout is similar to the alarm(2) system call: it registers a timeout (in seconds). The thread will exit automatically (even in the middle of a system call) if the timeout is reached. To reset the timeout, call pth_timeout with a timeout of 0. |
Richard Jones <rich@annexia.org> |
GNU LGPL (see http://www.gnu.org/) |
pthrlib-3.0.3 |
pth_poll(3), pth_select(3). |