mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-20 17:40:30 +00:00
Improve threading and i/o routines
- On Windows connect() can now be interrupted by a signal; connect() w/ O_NONBLOCK will now raise EINPROGRESS; and connect() with SO_SNDTIMEO will raise ETIMEDOUT after the interval has elapsed. - We now get the AcceptEx(), ConnectEx(), and TransmitFile() functions from the WIN32 API the officially blessed way, using WSAIoctl(). - Do nothing on Windows when fsync() is called on a directory handle. This was raising EACCES earlier becaues GENERIC_WRITE is required on the handle. It's possible to FlushFileBuffers() a directory handle if it's opened with write access but MSDN doesn't document what it does. If you have any idea, please let us know! - Prefer manual reset event objects for read() and write() on Windows. - Do some code cleanup on our dlmalloc customizations. - Fix errno type error in Windows blocking routines. - Make the futex polyfill simpler and faster.
This commit is contained in:
parent
f7343319cc
commit
49b0eaa69f
43 changed files with 528 additions and 425 deletions
4
third_party/nsync/mu_semaphore_gcd.c
vendored
4
third_party/nsync/mu_semaphore_gcd.c
vendored
|
@ -20,6 +20,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/clktck.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/thread/posixthread.internal.h"
|
||||
|
@ -116,8 +117,7 @@ errno_t nsync_mu_semaphore_p_with_deadline_gcd (nsync_semaphore *s,
|
|||
(pt->pt_flags & PT_NOCANCEL)) {
|
||||
result = nsync_dispatch_semaphore_wait (s, abs_deadline);
|
||||
} else {
|
||||
struct timespec now, until, slice;
|
||||
slice = timespec_frommillis (__SIG_LOCK_INTERVAL_MS);
|
||||
struct timespec now, until, slice = {0, 1000000000 / CLK_TCK};
|
||||
for (;;) {
|
||||
if (_weaken (pthread_testcancel_np) () == ECANCELED) {
|
||||
result = ECANCELED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue