summaryrefslogtreecommitdiff
path: root/locks
Commit message (Collapse)AuthorAgeFilesLines
* On 'xmllite' branch: Merge changes from trunk.xmlliteivan2019-05-273-62/+8
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/xmllite@1860149 13f79535-47bb-0310-9956-ffa450edef68
* On 'xmllite' branch: Merge changes from trunk.ivan2019-05-261-105/+36
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/xmllite@1860054 13f79535-47bb-0310-9956-ffa450edef68
* Use proc mutex pthread by default when robust[_np]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: http://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.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1855877 13f79535-47bb-0310-9956-ffa450edef68
* Revert 1839699, this contained unintended, additional noise. Re-correcting.wrowe2018-08-301-1/+1
| | | | git-svn-id: http://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_BUILDwrowe2018-08-301-1/+1
| | | | git-svn-id: http://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 compatiblewrowe2017-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: http://svn.apache.org/repos/asf/apr/apr/trunk@1797415 13f79535-47bb-0310-9956-ffa450edef68
* locks: thread: timedlock: better handling of spurious wakeups that may beylavic2017-05-072-36/+30
| | | | | | | | inherent to some native/OS condvar implementation. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1794266 13f79535-47bb-0310-9956-ffa450edef68
* locks: unix: follow up to r1792622.ylavic2017-04-251-17/+17
| | | | | | | | Indent block previously preserved (for easier review), no functional change. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1792625 13f79535-47bb-0310-9956-ffa450edef68
* locks: unix: timedlock: better handling of spurious wakeups that may beylavic2017-04-251-18/+27
| | | | | | | | inherent to some native/OS condvar implementation. git-svn-id: http://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.ylavic2017-04-251-8/+6
| | | | | | | | No functional change. git-svn-id: http://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 forylavic2017-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: http://svn.apache.org/repos/asf/apr/apr/trunk@1792620 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790436.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1791728 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790446.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1791718 13f79535-47bb-0310-9956-ffa450edef68
* apr_{thread,proc,global}_timedlock() with negative timeout is now equivalentylavic2017-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: http://svn.apache.org/repos/asf/apr/apr/trunk@1790632 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790488 and r1790521: likewise for theylavic2017-04-071-5/+5
| | | | | | | | apr_proc_mutex_unix_lock_methods_t's timedacquired method. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790523 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790488.ylavic2017-04-0711-11/+11
| | | | | | | | Make it clear in the type that it's a relative/interval time. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790521 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1790488 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1790446 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.ylavic2017-04-061-24/+28
| | | | | | | | | No functional change, more helpers/macros to help identify struct proc_pthread_mutex_t members. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790444 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330 and r1790436.ylavic2017-04-061-194/+0
| | | | | | | | | unix/misc.c is not needed anymore since we use apr_proc_mutex_trylock() directly. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790439 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790330.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1790436 13f79535-47bb-0310-9956-ffa450edef68
* Avoid a compiler warning by using system's errno.ylavic2017-04-051-1/+2
| | | | git-svn-id: http://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 anylavic2017-04-052-50/+318
| | | | | | | | implementation based on pthread_cond_timedwait() when possible. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790330 13f79535-47bb-0310-9956-ffa450edef68
* Make clear this is a delta timeoutjim2017-04-051-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790304 13f79535-47bb-0310-9956-ffa450edef68
* Use our "portable" versionsjim2017-04-051-8/+7
| | | | git-svn-id: http://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"jim2017-04-051-22/+4
| | | | | | | rr1790301 git-svn-id: http://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 ratherylavic2017-04-051-2/+5
| | | | | | | | then absolute. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1790296 13f79535-47bb-0310-9956-ffa450edef68
* the restjim2017-04-041-47/+180
| | | | git-svn-id: http://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 wejim2017-04-041-0/+4
| | | | | | | | call us, we could have blown past it... in that case, just try the lock git-svn-id: http://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, likejim2017-04-043-69/+82
| | | | | | | | osx/macos that don't have it. Be a bit more generous in the test git-svn-id: http://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.ylavic2017-04-031-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1789998 13f79535-47bb-0310-9956-ffa450edef68
* proc_mutex_pthread: simplify (shorten) methods' names by removingylavic2016-12-191-27/+26
| | | | | | | | the second/double proc_ (consistently with other mechanisms). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1775069 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.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: http://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).ylavic2016-09-173-4/+4
| | | | git-svn-id: http://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: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: http://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 ↵bjh2016-05-041-1/+1
| | | | | | variable name. git-svn-id: http://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 APRylavic2016-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: http://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 nativeylavic2016-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: http://svn.apache.org/repos/asf/apr/apr/trunk@1738925 13f79535-47bb-0310-9956-ffa450edef68
* proc_mutex-unix: follow up to r1733775.ylavic2016-04-121-1/+2
| | | | | | | Restore mmap-ed fd close stripped by above commit. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1738791 13f79535-47bb-0310-9956-ffa450edef68
* proc_mutex-netware: follow up to r1733775.ylavic2016-03-061-14/+2
| | | | | | | Make apr_os_proc_mutex_{get,set}[_ex]() available by changing the native apr_os_proc_mutex_t accessor type to a pointer. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733776 13f79535-47bb-0310-9956-ffa450edef68
* apr_proc/global_mutex: Fix API regarding the native OS mutexesylavic2016-03-066-124/+405
| | | | | | | | | | | | | | | | | | | | | | | accessors from/to available APR mechanisms, adding the new functions apr_os_proc_mutex_get_ex() and apr_os_proc_mutex_set_ex() which give control to the user over the selected mechanisms, including the missing POSIX semaphores (sem_t) on platforms supporting them. For POSIX sems, this moves the "sem_t *psem_interproc;" member from struct apr_proc_mutex_t to apr_os_proc_mutex_t (now complete) so that we can avoid members duplication between the two structs, and hence replace all the doublons in apr_os_proc_mutex_t with an apr_os_proc_mutex_t member, called "os", to be used for runtime. This first commit aims to be backportable to 1.6.x, thus does not address the Netware case which requires an incompatible change of the apr_proc_mutex_t to a pointer type (the implementation is here since very similar to other changes is this commit, but it is commented out for now, a simple follow up is coming with the type change for trunk only...). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733775 13f79535-47bb-0310-9956-ffa450edef68
* apr_proc_mutex-pthread: follow up to r1733694.ylavic2016-03-051-11/+3
| | | | | | Simplify #if/#else/#endif logic, no functional change. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733708 13f79535-47bb-0310-9956-ffa450edef68
* apr_proc_mutex-pthread: follow up to r1733694.ylavic2016-03-051-0/+2
| | | | | | | | Add missing refcount decrement when recovering the mutex from died owner, like in proc_mutex_proc_pthread_acquire() but this time for proc_mutex_proc_pthread_tryacquire() and proc_mutex_proc_pthread_timedacquire(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733706 13f79535-47bb-0310-9956-ffa450edef68
* apr_proc_mutex-pthread: Refcount shared mutexes usage to avoidylavic2016-03-051-5/+49
| | | | | | | | | destruction while still is use by some process(es). PR 49504. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733694 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.ylavic2015-03-251-6/+8
| | | | | | | | In apr_global_mutex_timedlock(), we can avoid converting from relative to absolute time if thread locking is not needed. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1669077 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1667900: handle negative (infinite) timeout in mutex/cond ↵ylavic2015-03-2014-180/+263
| | | | | | timedlock/timedwait. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1667962 13f79535-47bb-0310-9956-ffa450edef68
* locks: introduce apr_{thread,proc,global}_mutex_timedlock().ylavic2015-03-1912-47/+746
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For proc mutexes, the new mechanism APR_LOCK_DEFAULT_TIMED usable at creation time allows for the best mechanism to be elected (unixes: 1 to 3, or specific: 4 to 7): 1. PROC_PTHREAD if pthread_mutex_timedlock() and pthread_mutex_set_robust_np() are both available, 2. SYSV if semtimedop() is availale, 3. POSIXSEM if sem_timedwait() is available, 4. BeOS' acquire_sem_etc() if available, 5. NetWare falls back to apr_thread_mutex_timedlock() as for others functions, 6. OS2's DosRequestMutexSem(), 7. Windows' WaitForSingleObject(). Otherwise (like when fcntl and flock only are availble, if that's ever possible), APR_ENOTIMPL is returned. For thread mutexes, the new flag APR_THREAD_MUTEX_TIMED, usable at create() time still, allows to switch to an implementation using a condition variable and apr_thread_cond_timedwait() when if no native mechanism is available (eg. NetWare, pthreads but without pthread_mutex_timedlock() available). On windows, this initializes a WaitForSingleObject()able handle (Mutex) instead of the fastest (but not timeout-able) CRITICAL_SECTION used by default. All apr_{thread,proc,global}_mutex_timedlock() functions can take a relative or absolute time, thanks to the last (boolean) argument. Test suite updated accordingly. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1667900 13f79535-47bb-0310-9956-ffa450edef68
* Resolve failures with the POSIX sem implementation of APRtrawick2014-07-151-4/+18
| | | | | | | | | | | | | | process mutexes (and thus global mutexes) in environments which receive signals. EINTR is now handled on the sem_* calls that are documented as exposing EINTR in the Linux, FreeBSD, and/or Solaris docs. There are a few other calls that haven't been updated: sem_unlink(), sem_post(), and sem_close(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1610854 13f79535-47bb-0310-9956-ffa450edef68
* apr_os_proc_mutex_get() on Unix: Avoid segfault for cross-trawick2014-04-131-1/+6
| | | | | | | | | | process pthread mutexes. Submitted by: Yann Ylavic <ylavic.dev gmail.com> Reviewed by: trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1587063 13f79535-47bb-0310-9956-ffa450edef68