[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
* lib/select.c: Make select() multi-thread safe in windows
From: |
Akash Rawal |
Subject: |
* lib/select.c: Make select() multi-thread safe in windows |
Date: |
Wed, 24 May 2017 09:24:04 +0530 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
Hi,
I modified lib/select.c to fix misbehaving select() on windows
when select() is simultaneously called from multiple threads.
- I used a stack to reuse events created by CreateEvent()
in similar way to the original code. I have no idea
why event handle was reused in original code, so I
preserved this behavior.
- There is an obvious issue that my fix depends on pthread
which is probably unacceptable but I have no idea how to
use pthread only when pthread is actually used.
By the way the problem I fixed was that when multiple
threads call select() simultaneously, select() invocation
with the fd that received an event often remains blocked and
some other select() invocation returns.
Please let me know what you think of this patch.
Regards,
Akash Rawal
0001-lib-select.c-Make-select-multi-thread-safe-in-window.patch
Description: Text Data
- * lib/select.c: Make select() multi-thread safe in windows,
Akash Rawal <=