evthread.c


Log

Author Commit Date CI Message
Nate R c94a5f2a 2012-01-24T17:15:50 Do a memberwise comparison of threading function tables Doing a memcmp risks comparing uninitialized padding bytes at the end of the structure.
Nick Mathewson e7874133 2011-11-14T17:33:02 Don't try to make notifiable event_base when no threading fns are configured
Nick Mathewson 3c824bd3 2011-10-24T13:18:09 Update copyright dates to 2011.
Nick Mathewson e7fe9270 2011-07-04T12:16:08 Merge remote-tracking branch 'github/20_global_locks_init' into patches-2.0
Sebastian Hahn b0ff7eb5 2011-04-10T14:03:39 Add an assert to appease clang's static analyzer It got confused because in EVLOCK_ASSERT_LOCKED(lock) there is an if (lock) check.
Nick Mathewson cb6ecee7 2011-04-22T12:40:07 Complain if the caller tries to change threading cbs after setting them We never supported this; it was always fraught with errors; and I don't believe there is a good reason to _want_ it to work.
Nick Mathewson b683cae3 2011-04-22T12:01:25 Avoid race-condition when initializing global locks Previously, we did stuff like if (!lock) EVTHREAD_ALLOC_LOCK(lock,0); for the evsig base global lock, the arc4random lock, and the debug_map lock. But that's potentially racy! Instead, we move the responisiblity for global lock initialization to the functions where we set up the lock callbacks. (Rationale: We already require that you set up the locking callbacks before you create any event_base, and that you do so exatly once.)
Evan Jones fbe64f21 2010-12-02T10:26:12 Use relative includes instead of system includes consistently.
Nick Mathewson 5de2bcb7 2010-09-01T16:03:39 On windows, make lock/thread function tables static This requires us to have a separate implementation of the lock macros that indirects to a set of functions. Fortunately, this isn't too hard to do. This may be a fix for bug 3042969, where our openssl dll and our libevent dll each got their own version of the thread stuff.
Nick Mathewson 743f8665 2010-08-23T11:48:46 Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code
Nick Mathewson d4977b52 2010-08-17T13:15:34 Add a condition variable backend, with implementations for pthreads and win32 The interface from the user's POV is similar to the locking implementation: either provide a structure full of function pointers, or just call evthread_use_*_threads() and everything will be okay. The internal interface is meant to vaguely resemble pthread_cond_*, which Windows people will better recognize as *ConditionVariable*.
Nick Mathewson 3808168d 2010-08-10T15:02:50 Completely remove the (mostly-removed) obsolete thread functions.
Nick Mathewson ec347b92 2010-07-07T16:45:03 Move event-config.h to include/event2 This change means that all required include files are in event2, and all files not in event2/* are optional.
Nick Mathewson c5bab560 2010-05-11T11:44:07 Remove the obsolete evthread interfaces These were added in 2.0.1, and deprecated in 2.0.4 and 2.0.5; we've promised that they would be removed, and warned whenever they were invoked. Users should call evthread_set_lock_callbacks instead... or ideally just call evthread_use_windows_threads or evthread_use_pthreads.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
unknown c51bb3c3 2009-12-21T16:36:40 Fix a few locking issues on windows.
Nick Mathewson 0cd3bb9f 2009-11-27T17:22:19 Improved optional lock debugging. There were a couple of places in the code where we manually kept lock counts to make sure we never accessed resources without holding a lock, and that we never released a lock we didn't have. The lock-debugging code already puts counts on _every_ lock when lock debugging is enabled, so there is no need to keep these counts around otherwise. This patch rewrites the ASSERT_FOO_LOCKED macros to all use a common EVLOCK_ASSERT_LOCKED(). We also teach the lock debugging code to keep track of who exactly holds each lock, so that EVLOCK_ASSERT_LOCKED() means "locked by this thread."
Nick Mathewson 76cd2b70 2009-11-27T16:44:47 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks. Previously, our default lock model kind of assumed that every lock was potentially a read-write lock. This was a poor choice, since read-write locks are far more expensive than regular locks, and so the lock API should only use them when we can actually take advantage of them. Neither our pthreads or win32 lock implementation provided rw locks. Now that we have a way (not currently used!) to indicate that we really want a read-write lock, we shouldn't actually say "lock this for reading" or "lock this for writing" unless we mean it.
Nick Mathewson 347952ff 2009-11-27T15:20:43 Revise the locking API: deprecate the old locking callbacks and add trylock. Previously, there was no good way to request different kinds of lock (say, read/write vs writeonly or recursive vs nonrecursive), or for a lock function to signal failure (which would be important for a trylock mode). This patch revises the lock API to be a bit more useful. The older lock calls are still supported for now. We also add a debugging mode to catch common errors in using the locking APIs.