summaryrefslogtreecommitdiff
path: root/locks
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-2014-125/+125
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* Stage 1 in cleaning win95 code ... cleanup utilsMladen Turk2021-12-021-26/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895509 13f79535-47bb-0310-9956-ffa450edef68
* Stage 3 in dismantling _WIN32_WCE ... cleanup codeMladen Turk2021-12-021-9/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895508 13f79535-47bb-0310-9956-ffa450edef68
* * locks/unix/thread_mutex.c,Joe Orton2021-07-021-0/+9
| | | | | | | | | include/arch/unix/apr_arch_thread_mutex.h: Completely drop the code required imitate the mutex via a condition variable if HAVE_PTHREAD_MUTEX_TIMEDLOCK is defined. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891204 13f79535-47bb-0310-9956-ffa450edef68
* * configure.in: Add --enable-thread-debug, which definesJoe Orton2020-06-011-0/+19
| | | | | | | | | | | | | | | APR_THREAD_DEBUG. * locks/unix/thread_mutex.c (apr_thread_mutex_create): For APR_THREAD_DEBUG, use the ERRORCHECK mutex type by default (if not nested/recursive), which reliably fails for cases of otherwise undefined behaviour: a) relocking a mutex locked by the current thread b) unlocking a thread locked by another thread git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878362 13f79535-47bb-0310-9956-ffa450edef68
* * locks/unix/proc_mutex.c (apr_proc_mutex_defname): Fix clang warning,Joe Orton2020-06-011-3/+2
| | | | | | | remove unused local variable. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878342 13f79535-47bb-0310-9956-ffa450edef68
* Follow-up to r1860075: Remove unused local variable.Ivan Zhakov2019-09-081-1/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866619 13f79535-47bb-0310-9956-ffa450edef68
* Refactor win32 thread_mutex code. No functional changes intended.Ivan Zhakov2019-09-031-12/+29
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866302 13f79535-47bb-0310-9956-ffa450edef68
* Windows platform: Use semaphore object instead of manual reset event toIvan Zhakov2019-06-071-6/+5
| | | | | | implement timed unnested apr_thread_mutex_t. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860744 13f79535-47bb-0310-9956-ffa450edef68
* * locks/win32/thread_mutex.cIvan Zhakov2019-05-281-16/+3
| | | | | | | (apr_thread_mutex_create): Remove Windows 9x compatibility code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860195 13f79535-47bb-0310-9956-ffa450edef68
* win32: Factor out common code to private function apr_wait_for_single_object().Ivan Zhakov2019-05-263-62/+8
| | | | | | | | | | | | | | | | | This function almost the same as WaitForSingleObject() except it accepts timeout value in microseconds, instead of milliseconds. * include/arch/win32/apr_arch_misc.h * misc/win32/misc.c (apr_wait_for_single_object): New. Factored out from thread_cond_timedwait(). * locks/win32/proc_mutex.c * locks/win32/thread_cond.c * locks/win32/thread_mutex.c (apr_proc_mutex_timedlock, thread_cond_timedwait, apr_thread_mutex_timedlock): Use apr_wait_for_single_object(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860075 13f79535-47bb-0310-9956-ffa450edef68
* Use native Slim Reader/Writer (SRW) locks on Windows for apr_rwlock_t.Ivan Zhakov2019-05-201-105/+36
| | | | | | This fixes PR 45455 and PR 51360. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1859584 13f79535-47bb-0310-9956-ffa450edef68
* Use proc mutex pthread by default when robust[_np]Yann Ylavic2019-03-221-6/+22
| | | | | | | | | | | | | On platforms that support pshared and robust pthread mutex, this is usually the best interprocess mutex mechanism because it's efficient, posix, not limited and not persistent on the system when the program exits (i.e. no need to delete it explicitely before leaving, like IPC SysV or files for instance). Note that on older POSIX systems pthread_mutex_{setrobust,consistent}() funcs existed with the non-posix _np() suffix, and we consider them equivalent. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856022 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread_cond_timedwait on windows should wait on the semaphore.Yann Ylavic2019-03-201-1/+1
| | | | | | | | | | Fix r1792620's bad copy/paste from mutex code. Submitted by: fedormsv gmail.com Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1855877 13f79535-47bb-0310-9956-ffa450edef68
* Revert 1839699, this contained unintended, additional noise. Re-correcting.William A. Rowe Jr2018-08-301-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1839700 13f79535-47bb-0310-9956-ffa450edef68
* Revert 1839627, this macro does not result in a usable CC_FOR_BUILDWilliam A. Rowe Jr2018-08-301-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1839699 13f79535-47bb-0310-9956-ffa450edef68
* On Windows, OS2 and BEOS, the singluar lock mechanisms were already compatibleWilliam A. Rowe Jr2017-06-023-9/+9
| | | | | | | | | | with timed locks, so there is no delta between DEFAULT and DEFAULT_TIMED. Avoid gratuitous API changes to typical OS lock information. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1797415 13f79535-47bb-0310-9956-ffa450edef68
* locks: thread: timedlock: better handling of spurious wakeups that may beYann Ylavic2017-05-072-36/+30
| | | | | | | | inherent to some native/OS condvar implementation. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1794266 13f79535-47bb-0310-9956-ffa450edef68
* locks: unix: follow up to r1792622.Yann Ylavic2017-04-251-17/+17
| | | | | | | | Indent block previously preserved (for easier review), no functional change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1792625 13f79535-47bb-0310-9956-ffa450edef68
* locks: unix: timedlock: better handling of spurious wakeups that may beYann Ylavic2017-04-251-18/+27
| | | | | | | | inherent to some native/OS condvar implementation. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1792622 13f79535-47bb-0310-9956-ffa450edef68
* locks: unix: provide a macro helper for a pattern used several times.Yann Ylavic2017-04-251-8/+6
| | | | | | | | No functional change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1792621 13f79535-47bb-0310-9956-ffa450edef68
* locks: Windows: work around 64bit usecs to native 32bit msecs timeouts forYann Ylavic2017-04-253-10/+67
| | | | | | | | | apr_{proc,thread}_{mutex,cond}_timed{lock,wait}(), such that the given timeout interval value is not truncated or switched from/to signed/unsigned. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1792620 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790436.Yann Ylavic2017-04-171-5/+6
| | | | | | | | | Fix proc_mutex_pthread_acquire_ex() for the APR_USE_PROC_PTHREAD_MUTEX_COND case which shouldn't use undefined pthread_cond_timedwait(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1791728 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790446.Yann Ylavic2017-04-171-5/+9
| | | | | | | | | Since proc_pthread_mutex_cond_locked() macro is also used as an lvalue, don't define it as a conditional and put the condition where needed in the code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1791718 13f79535-47bb-0310-9956-ffa450edef68
* apr_{thread,proc,global}_timedlock() with negative timeout is now equivalentYann Ylavic2017-04-079-106/+55
| | | | | | | | | to apr_{thread,proc,global}_trylock(), i.e. immediate attempt to acquire the lock (but returning APR_TIMEUP if busy). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790632 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790488 and r1790521: likewise for theYann Ylavic2017-04-071-5/+5
| | | | | | | | apr_proc_mutex_unix_lock_methods_t's timedacquired method. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790523 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790488.Yann Ylavic2017-04-0711-11/+11
| | | | | | | | Make it clear in the type that it's a relative/interval time. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790521 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.Yann Ylavic2017-04-0711-187/+115
| | | | | | | | | | | | | Axe the 'absolute' argument of apr_{thread,proc,global}_mutex_timedlock() which was confusing, hence 'timeout' is always relative now. It still makes sense (to me) to handle a negative timeout as INFINITE, a nul one as IMMEDIATE, and a positive one as an upper bound timeout (like most if not all of the underlying system calls...). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790488 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.Yann Ylavic2017-04-061-1/+1
| | | | | | | | | Don't try to access proc_pthread_mutex_t's condvar if the mutex was _put[_ex]() and not _create()d, this is a real pthread_mutex_t. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790446 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.Yann Ylavic2017-04-061-24/+28
| | | | | | | | | No functional change, more helpers/macros to help identify struct proc_pthread_mutex_t members. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790444 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330 and r1790436.Yann Ylavic2017-04-061-194/+0
| | | | | | | | | unix/misc.c is not needed anymore since we use apr_proc_mutex_trylock() directly. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790439 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.Yann Ylavic2017-04-061-101/+154
| | | | | | | | | | | | | | | | | | | When no native timedlock is available, fall back to a common/generic spin sleep proc_mutex_spinsleep_timedacquire() based on the configured APR_USE_*_SERIALIZE trylock. Otherwise, choose the best timedlock mechanism in the following order: 1. PTHREAD if HAVE_PTHREAD_MUTEX_ROBUST && (HAVE_PTHREAD_MUTEX_TIMEDLOCK || HAVE_PTHREAD_CONDATTR_SETPSHARED) 2. SYSV if HAVE_SEMTIMEDOP 3. POSIX if HAVE_SEM_TIMEDWAIT 4. The one of APR_USE_*_SERIALIZE, hence possibly non-robust and/or spinning with the same robustness as the underlying apr_proc_mutex_trylock() call. apr_proc_mutex_timedlock() won't return ENOTIMPL anymore. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790436 13f79535-47bb-0310-9956-ffa450edef68
* Avoid a compiler warning by using system's errno.Yann Ylavic2017-04-051-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790331 13f79535-47bb-0310-9956-ffa450edef68
* locks: when pthread_mutex_timedlock() isn't available, fall back to anYann Ylavic2017-04-052-50/+318
| | | | | | | | implementation based on pthread_cond_timedwait() when possible. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790330 13f79535-47bb-0310-9956-ffa450edef68
* Make clear this is a delta timeoutJim Jagielski2017-04-051-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790304 13f79535-47bb-0310-9956-ffa450edef68
* Use our "portable" versionsJim Jagielski2017-04-051-8/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790303 13f79535-47bb-0310-9956-ffa450edef68
* semtimedop() takes a delta time, so accept what is given as the "time remaining"Jim Jagielski2017-04-051-22/+4
| | | | | | | rr1790301 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790302 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1667900: semtimedop() should be passed a relative timeout ratherYann Ylavic2017-04-051-2/+5
| | | | | | | | then absolute. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790296 13f79535-47bb-0310-9956-ffa450edef68
* the restJim Jagielski2017-04-041-47/+180
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790157 13f79535-47bb-0310-9956-ffa450edef68
* Be safe... if we had a super small timeout then by the time weJim Jagielski2017-04-041-0/+4
| | | | | | | | call us, we could have blown past it... in that case, just try the lock git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790111 13f79535-47bb-0310-9956-ffa450edef68
* Add in our own pthread_mutex_timedlock impl for those OSs, likeJim Jagielski2017-04-043-69/+82
| | | | | | | | osx/macos that don't have it. Be a bit more generous in the test git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790107 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1733694: proc-pthreads have their own child_init() now.Yann Ylavic2017-04-031-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1789998 13f79535-47bb-0310-9956-ffa450edef68
* proc_mutex_pthread: simplify (shorten) methods' names by removingYann Ylavic2016-12-191-27/+26
| | | | | | | | the second/double proc_ (consistently with other mechanisms). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1775069 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.Yann Ylavic2016-12-191-0/+4
| | | | | | | | | | As noticed by rjung, not all pthread implementations have mutex_timedlock(), like Solaris 8, so proc_mutex_proc_pthread_timedacquire() can return APR_ENOTIMPL. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1774973 13f79535-47bb-0310-9956-ffa450edef68
* locks/netware: follow up to r1667962 and r1667900: fix typos (compile errors).Yann Ylavic2016-09-173-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1761279 13f79535-47bb-0310-9956-ffa450edef68
* apr_os_proc_mutex_get_ex: win32: fix typo (s/mutex/pmutex/) leading to:Yann Ylavic2016-08-111-1/+1
| | | | | | | | | locks\win32\proc_mutex.c(252): error C2065: 'mutex' : undeclared identifier Submitted by: Ivan Zhakov <ivan visualsvn.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1755954 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Fix compile breakage in apr_thread_mutex_timedlock() due to incorrect ↵Brian Havard2016-05-041-1/+1
| | | | | | variable name. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1742215 13f79535-47bb-0310-9956-ffa450edef68
* apr_os_proc_mutex-unix: For consistency with other OS native to APRYann Ylavic2016-04-131-1/+5
| | | | | | | | | types constructors/_put()ers and non-unix mutex mechanisms, always destroy the underlying native mutex when apr_proc_mutex_destroy() is called explicitly. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1738926 13f79535-47bb-0310-9956-ffa450edef68
* apr_os_proc_mutex_put_ex: Allow to specify whether the OS nativeYann Ylavic2016-04-135-5/+42
| | | | | | | | | mutex should or not be cleaned up (destroyed) with the constructed APR mutex (given pool), and default to not for the simple _put() function. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1738925 13f79535-47bb-0310-9956-ffa450edef68
* proc_mutex-unix: follow up to r1733775.Yann Ylavic2016-04-121-1/+2
| | | | | | | Restore mmap-ed fd close stripped by above commit. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1738791 13f79535-47bb-0310-9956-ffa450edef68