summaryrefslogtreecommitdiff
path: root/test/testlock.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-201-13/+13
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* test/testlock: Fix -Werror=return-typeYann Ylavic2022-06-231-0/+2
| | | | | | | | | | * test/testlock.c(thread_mutex_function, thread_mutex_sleep_function): Thread (APR_THREAD_FUNC) functions should return a pointer (NULL). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902181 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c (thread_mutex_function): Test that locking andJoe Orton2021-07-021-17/+36
| | | | | | | | unlocking succeed. Catch thread join errors and thread exit status throughout. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891203 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c (test_timeoutmutex): Fix test to avoid undefinedJoe Orton2020-06-011-4/+50
| | | | | | | | behaviour by relocking a non-recursive mutex; spawn a thread to hold the lock. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878357 13f79535-47bb-0310-9956-ffa450edef68
* Follow-up to r1866300: Add missing return value in test function.Ivan Zhakov2019-09-091-0/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866712 13f79535-47bb-0310-9956-ffa450edef68
* Add test for WAIT_ABANDONED handling for win32 mutexes. Code works asIvan Zhakov2019-09-031-0/+42
| | | | | | expected. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866300 13f79535-47bb-0310-9956-ffa450edef68
* Add simple tests for nested and unnested thread mutexes.Ivan Zhakov2019-05-281-0/+50
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860190 13f79535-47bb-0310-9956-ffa450edef68
* Fix testlock failures on platforms where default mutex is nested.Ivan Zhakov2019-05-271-1/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860163 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c (test_timeoutcond): Increase fudge factor inJoe Orton2017-09-191-1/+1
| | | | | | | | checking timeout precision; 100ms failed regularly in Fedora builds, 500ms has Never Failed(TM). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1808910 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1790488, r1790521 and r1790523: likewise for the tests.Yann Ylavic2017-04-071-3/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790569 13f79535-47bb-0310-9956-ffa450edef68
* locks: follow up to r1667900.Yann Ylavic2017-04-071-2/+2
| | | | | | | | | | | | | 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
* Add in our own pthread_mutex_timedlock impl for those OSs, likeJim Jagielski2017-04-041-1/+1
| | | | | | | | 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
* locks: introduce apr_{thread,proc,global}_mutex_timedlock().Yann Ylavic2015-03-191-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: https://svn.apache.org/repos/asf/apr/apr/trunk@1667900 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c: Revert 502048, accidentally snuck in with Joe Orton2007-03-011-4/+4
| | | | | | | Netware BASEDIR changes? git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@513263 13f79535-47bb-0310-9956-ffa450edef68
* Implement a BASEDIR build environment variable to allow the NetWare build to ↵Bradley Nicholes2007-01-311-4/+4
| | | | | | | | relocate the install files Submitted by: Guenter Knauf <fuankg apache org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@502048 13f79535-47bb-0310-9956-ffa450edef68
* Fix the typo.Joe Orton2006-08-031-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
* Update license header.Joe Orton2006-08-031-6/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
* Fix an assert that occurs when you destroy a rwlock on win32 and later clearGarrett Rooney2006-01-221-0/+2
| | | | | | | | | | | | | | | | | | | | the pool it was allocated from. Submitted by: Evgueni Brevnov <evgueni.brevnov gmail.com> * locks/win32/thread_rwlock.c (apr_thread_rwlock_destroy): Use apr_pool_cleanup_run to call our cleanup function. (thread_rwlock_cleanup): Put the destruction of the rwlock here instead of in the destructor function. * test/testlock.c (test_thread_rwlocks): Destroy the rwlock explicitly so we can see this kind of problem. * CHANGES: Note change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@371172 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-041-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@151412 13f79535-47bb-0310-9956-ffa450edef68
* The failure to delete the conditional lock ws causing a hang on BeOS, soDavid Reid2004-06-301-0/+2
| | | | | | | | | | delete the lock when we're done and all is well again. As the tests don't run in isolation there may be other places we should clean up better. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65245 13f79535-47bb-0310-9956-ffa450edef68
* Presently if we fail in apr_assert_success we get the line number forDavid Reid2004-06-071-9/+9
| | | | | | | | | | | | testutil.c reported. Not very useful. This change adds the passing of the (correct) line number and also a macro to ease said passing. I've changed all instances of apr_assert_success to use the new macro, but not all the tests build on this platform so others should check that all is well for them. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65171 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c (test_thread_rwlock): Catch ENOTIMPL.Joe Orton2004-05-251-0/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65128 13f79535-47bb-0310-9956-ffa450edef68
* Add the line number to the verbose output from abts. This also removesRyan Bloom2004-05-141-26/+26
| | | | | | | a test that is segfaulting in testshm. That will need to be fixed. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65095 13f79535-47bb-0310-9956-ffa450edef68
* Move the APR test suite from CuTest to abts. The output is cleaner,Ryan Bloom2004-05-131-39/+39
| | | | | | | | | | | | and it prints output while running the test. Also, if a test fails the rest of the test function is run, allowing for proper cleanup. Finally, it is possible to call the same function multiple times with different data, and each call is considered a separate test. This is the first of a multi-step process to get a more useful test suite. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65091 13f79535-47bb-0310-9956-ffa450edef68
* Relicense APR under Apache License, Version 2.0Justin Erenkrantz2004-02-131-49/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64904 13f79535-47bb-0310-9956-ffa450edef68
* * include/apr_thread_cond.h: Note when destroying a condvar givesJoe Orton2003-12-291-7/+12
| | | | | | | | | | | | | | | undefined results in a POSIX implementation. * locks/unix/thread_cond.c (apr_thread_cond_create): Don't run cleanup if pthread_cond_init fails since that gives undefined results. (apr_thread_cond_destroy): Use apr_pool_cleanup_run so the cleanup is always unregistered. * test/testlock.c (test_cond): Test apr_thread_cond_destroy and use apr_assert_success() a little more. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64848 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright notices to 2003.Thom May2003-01-011-1/+1
| | | | | | | No functional changes git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64251 13f79535-47bb-0310-9956-ffa450edef68
* Move CuAssertSuccess to apr_assert_success, and remove it from theRyan Bloom2002-12-061-5/+5
| | | | | | | | CuTest sources. This keeps the CuTest sources clean of any knowledge about APR. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64126 13f79535-47bb-0310-9956-ffa450edef68
* Use CuAssertSuccess for some rv==APR_SUCCESS checks which are currentlyJoe Orton2002-12-061-5/+5
| | | | | | | failing on various platforms. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64122 13f79535-47bb-0310-9956-ffa450edef68
* Migrate testlock to the new test suite.Ryan Bloom2002-12-031-250/+97
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64113 13f79535-47bb-0310-9956-ffa450edef68
* use new time conversion macros in place of APR_USEC_PER_SECBrian Pane2002-07-051-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63565 13f79535-47bb-0310-9956-ffa450edef68
* allow the testlock program to continue on systems where read/write locksJeff Trawick2002-04-111-3/+9
| | | | | | | aren't implemented (e.g., Darwin); there is still useful stuff to test git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63251 13f79535-47bb-0310-9956-ffa450edef68
* Remove all uses of the apr_lock.h API from the tests.Aaron Bannert2002-04-091-216/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63232 13f79535-47bb-0310-9956-ffa450edef68
* Update our copyright for this year.Roy T. Fielding2002-03-131-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63117 13f79535-47bb-0310-9956-ffa450edef68
* roll the extra apr_lock_create_np() functionality into apr_lock_create()Jeff Trawick2001-12-291-4/+4
| | | | | | | | | | | and get rid of apr_lock_create_np(); apr_lock_create() has a new parameter for specifying the lock mechanism (or APR_LOCK_DEFAULT to let APR choose) (same for apr_proc_mutex_create_np() and apr_proc_mutex_create()) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62684 13f79535-47bb-0310-9956-ffa450edef68
* while on some platforms you can get away with the bug ofJeff Trawick2001-12-021-1/+3
| | | | | | | | | | | | calling pthread_cond_timedwait() (and thus apr_thread_cond_timedwait()) without holding the mutex, you can't on AIX; the system recognizes the error and returns EINVAL so fix the testlock program to grab the mutex git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62595 13f79535-47bb-0310-9956-ffa450edef68
* Added a new parameter to apr_thread_mutex_init(). Mutexes are now byAaron Bannert2001-10-171-4/+4
| | | | | | | | | | | | | | | | default not nested, but an init flag can enable them. I added a new test to testlockperf to show how much faster non-nested mutexes are. I also updated calls to apr_thread_mutex_init() wherever I could find them. This patch only implements this for Unix (nested locks already existed on Unix, so this patch just optionally enables/disables them). I did my best to change the function declaration on other platforms, but someone will have to double check me. Those other platforms will also have to either enable nested locks (sometimes available in their thread library) or just do what Unix does. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62435 13f79535-47bb-0310-9956-ffa450edef68
* Let's just make these consistent. All have declared prototypes now, andAaron Bannert2001-10-121-7/+9
| | | | | | | they all return apr_status_t. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62422 13f79535-47bb-0310-9956-ffa450edef68
* clean up some gcc warningsJeff Trawick2001-10-121-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62421 13f79535-47bb-0310-9956-ffa450edef68
* New test for apr_thread_cond_timedwait().Aaron Bannert2001-10-121-0/+77
| | | | | | | | | | | | | | | | Sets the timer at 5 seconds. No signals are thrown. Measures the time that we were asleep. - If the timer comes back early with APR_TIMEUP, then it passes. - If it comes back more than 100ms late, it fails. (We may wish to fool with the timeout leeway, I think 100ms is pretty generous, especially since the timeout is supposed to be a maximum.) - If it comes back and there is no error, we try again (up to 5 times) since it was probably just a spurious wakeup. - If we get an error that is not APR_TIMEUP, it failed. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62420 13f79535-47bb-0310-9956-ffa450edef68
* I accidentally commented out this function in my last commit.Ryan Bloom2001-09-151-3/+2
| | | | | | | | | | This puts it back in, but it also makes a failure non-terminal. Read/write locks were not implemented for the old API on Windows, but they are using the new API, so this failure can't be terminal, because if it is, the new API isn't tested. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62328 13f79535-47bb-0310-9956-ffa450edef68
* This allows us to generate a valid Makefile on Visual C++ 7.0.Ryan Bloom2001-09-151-2/+2
| | | | | | | This should work on versions of VC++ as well. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62326 13f79535-47bb-0310-9956-ffa450edef68
* Add condition variables to the APR set of locking functions.Ryan Bloom2001-09-131-2/+143
| | | | | | | | | This does Unix, and provides stubs for all other platforms. Submitted by: Aaron Bannert <aaron@clove.org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62317 13f79535-47bb-0310-9956-ffa450edef68
* Update the testlock program, to use the new locking API as well as theRyan Bloom2001-09-101-0/+163
| | | | | | | | | | old one. This allows people porting platforms to the new API to easily determine when they get it right. Submitted by: Aaron Bannert <aaron@clove.org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62301 13f79535-47bb-0310-9956-ffa450edef68
* allow the name of a lock file to be specified on the command lineJeff Trawick2001-08-301-5/+28
| | | | | | | | | when the current directory is a mount which will not support a lock (e.g., some NFS), -f /tmp/mylock can be used to circumvent the problem git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62261 13f79535-47bb-0310-9956-ffa450edef68
* change some of the test programs to use exit status 0 forJeff Trawick2001-08-011-1/+1
| | | | | | | success git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62073 13f79535-47bb-0310-9956-ffa450edef68
* More foonessWilliam A. Rowe Jr2001-07-271-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62040 13f79535-47bb-0310-9956-ffa450edef68
* Bring testlock in line with the rest of the test apps and change the orderDavid Reid2001-06-061-49/+63
| | | | | | | | of the tests to have the least implemented at the end. Also now has better output and errors are preserved shown. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61727 13f79535-47bb-0310-9956-ffa450edef68
* This adds a test to testlock for locking the same lock from the sameDavid Reid2001-06-061-18/+68
| | | | | | | thread a number of times. Win32 and OS/2 don't have the changes yet. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61717 13f79535-47bb-0310-9956-ffa450edef68
* Implement read write locks. This commit will support POSIX pthreadJustin Erenkrantz2001-05-311-0/+250
rw locks on Unix platforms. This is based on earlier patches that I posted to apr-dev, but did not receive feedback from others on. Hence, I'm committing. This will require a buildconf run for those of you who use Unix. This has only really been tested on Solaris, but it should work for those platforms that have POSIX rw locks. Other Unix platforms will simply return APR_ENOTIMPL. Add apr_lock_acquire_rw(). Notice that the Unix implementation will only allow a readwrite lock to be acquired via this function. Technically, apr_lock_acquire could obtain some sort of readwrite lock in this case, but that might lead to confusion. Added test/testlock.c which will attempt to test *both* APR_MUTEX and APR_READWRITE. This was based off of the testthread.c, but has been rewritten to use the new stdin/stdout/stderr code and just make more sense overall. testthread.c should probably be rewritten to test threading more specifically. Added framework that will hopefully still let BeOS, OS/2, and Win32 compile. Any operation relating to an APR_READWRITE lock on these platforms should just return APR_ENOTIMPL until the appropriate people get around to it. Some structure has been added to make what they have to implement fairly obvious. Again, I hope it compiles, but I can't guarantee it. Christian Gross has a Win32 readwrite lock patch floating around, but I can't vouch for Win32 code. The other platforms probably have ways to do it, but I'm not sure what they are. (Sorry, I write long commit messages...) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61682 13f79535-47bb-0310-9956-ffa450edef68