| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
This could interfere with cleanup handlers that try to acquire
mutexes while other threads holding these try to e.g. cancel the threads.
As cleanup handlers are only queued by the threads themselves we don't need
any synchronization to access the list.
Fixes #1401.
|
|
|
|
| |
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
|
| |
|
|
|
|
|
| |
This is called only by the thread for its own thread_t, and does not need
synchronization.
|
|
|
|
|
|
|
|
|
|
|
| |
sem_init() is deprecated on OS X, and it actually fails with ENOSYS. Using our
wrapped semaphore object is not an option, as it relies on the thread cleanup
that we can't rely on at this stage.
It is unclear why startup synchronization is required, as we can allocate the
thread ID just before creating the pthread. There is a chance that we allocate
a thread ID for a thread that fails to create, but the risk and consequences
are negligible.
|
| |
|
|
|
|
|
| |
As we are now using poll(2) instead of select(2), we need the work-around from
76dc329e for poll() as well.
|
|
|
|
|
|
|
|
|
|
|
| |
We explicitly avoided TryAcquireSRWLockExclusive() because of crashes. This
issue was caused by a MinGW-w64 bug (mingw-w64 fix 46f77afc). Using a newer
toolchain works fine.
While try_write_lock() obviously can fail, not supporting it is not really an
option, as some algorithms depend on occasionally successful calls. Certificate
caching in the certificate manager and the cred_set cache rely on successful
try_write_lock()ing.
|
|
|
|
|
|
| |
This fixes some vici test cases on OS X, where the test thread tries to cancel
the watcher thread during cleanup, but fails as select() does not honor the
pre-issued cancellation request.
|
|
|
|
|
|
|
|
| |
Because this->thread is also read by threads that don't hold the
mutex the previous implementation was problematic (especially since
pthread_t is an opaque type of unknown length).
Fixes #654.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of cleaning up all thread-values during destruction, cleanup handler
is invoked when a thread detaches. Thread detaching is cough using the Windows
DllMain() entry point, and allows us to basically revert 204098a7.
Using this mechanism, we make sure that the cleanup handler is invoked by the
the correct thread. Further, this mechanism works for externally-spawned
threads which run outside of our thread_cb() routine, and works more efficiently
with short-running threads.
|
|
|
|
|
| |
For x86_64 it does not actually matter, but for i686 builds the call convention
is different with WINAPI.
|
| |
|
| |
|
|
|
|
|
| |
This avoids any races during cleanup invocation if multiple cancel() requests
come in.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
An rwlock wait is not a thread cancellation point. As a canceled thread
would not have released the mutex, the rwlock would have been left in unusable
state.
|
|
|
|
| |
Recursive read locks don't seem to work properly, at least on 10.9.
|
|
|
|
|
| |
Semaphore wait functions should be a thread cancellation point, but did
not properly release the mutex in the fallback implementation.
|
|
|
|
|
| |
A caller expects that the associated rwlock is held, whether the condvar
gets signaled or the wait times out.
|
| |
|
|
|
|
|
|
| |
The compiler spits no warning, but the wrong symbol is used when calling
semaphore_create() from strongSwan. Override the name with a #define to force
the use of our semaphore_create().
|
|
|
|
|
|
|
|
|
|
| |
SIGRTMIN is defined as 32 while sigset_t is defined as
unsigned long (i.e. holds 32 signals). Hence, the signal
could never be blocked. Sending the signal still canceled
threads, but sometimes in situations where they shouldn't
have been canceled (e.g. while holding a lock).
Fixes #298.
|
|
|
|
|
| |
_POSIX_SPIN_LOCKS does not seem to be defined correctly on all
systems (Debian libc 2.3.6). Fixes #262.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
POSIX semaphores use CLOCK_REALTIME, but our semaphore_t abstraction
expects CLOCK_MONOTONIC based times. Use the mutex/condvar based
fallback if time_monotonic() actuall returns monotonic times.
|
|
|
|
|
|
| |
unavailable
Fixes #214.
|
|\
| |
| |
| |
| |
| |
| |
| | |
This branch introduces a userland IPsec implementation (libipsec) and an
Android App which targets the VpnService API that is provided by Android 4+.
The implementation is based on the bachelor thesis 'Userland IPsec for
Android 4' by Giuliano Grassi and Ralf Sager.
|
| |
| |
| |
| |
| |
| | |
Within the Android App the library stays loaded in memory and is just
initialized/deinitialized with each connection, the static thread
counter would continuously increase without this patch.
|
|/ |
|
| |
|
|
|
|
|
|
| |
The pthread implementation on Android currently only supports 64
different thread-specific values per process, which we hit easily when
every rwlock_t requires one.
|
|
|
|
| |
thread_value_t objects
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
If possible gettid() is used, otherwise pthread_self() is logged (which is
not completely portable, but seems to work on most supported platforms).
|
|
|
|
| |
mangle it
|