LibC: Implement pthread cancelation
This code is not tested at all but it looks correct xD
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||
{
|
||||
pthread_testcancel();
|
||||
if (timeout < 0)
|
||||
return ppoll(fds, nfds, nullptr, nullptr);
|
||||
const timespec timeout_ts {
|
||||
@@ -15,5 +17,6 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||
|
||||
int ppoll(struct pollfd fds[], nfds_t nfds, const struct timespec* timeout, const sigset_t* sigmask)
|
||||
{
|
||||
pthread_testcancel();
|
||||
return syscall(SYS_PPOLL, fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user