Permalink
Browse files

Provide OpenSSL style support for multiple threads accessing the same…

… event_base

svn:r684
  • Loading branch information...
1 parent 19dad16 commit 558de9b3776bf378fe2416c1c86639bc7abef3db @provos provos committed Mar 2, 2008
Showing with 754 additions and 36 deletions.
  1. +1 −0 ChangeLog
  2. +1 −1 Makefile.am
  3. +1 −1 autogen.sh
  4. +17 −1 configure.in
  5. +7 −0 event-internal.h
  6. +185 −26 event.c
  7. +74 −0 evthread-internal.h
  8. +2 −1 http.c
  9. +2 −2 include/Makefile.am
  10. +279 −0 m4/acx_pthread.m4
  11. +7 −3 test/Makefile.am
  12. +5 −1 test/regress.c
  13. +2 −0 test/regress.h
  14. +171 −0 test/regress_pthread.c
View
@@ -56,6 +56,7 @@ Changes in current version:
o rewrite of the evbuffer code to reduce memory copies
o Some older Solaris versions demand that _REENTRANT be defined to get strtok_r(); do so.
o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
+ o Provide OpenSSL style support for multiple threads accessing the same event_base
Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
View
@@ -29,7 +29,7 @@ VERSION_INFO = 2:0:0
bin_SCRIPTS = event_rpcgen.py
EXTRA_DIST = autogen.sh event.h event-internal.h log.h evsignal.h evdns.3 \
- evrpc.h evrpc-internal.h min_heap.h \
+ evrpc.h evrpc-internal.h min_heap.h evthread-internal.h \
event.3 \
kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \
evport.c devpoll.c event_rpcgen.py \
View
@@ -4,7 +4,7 @@ SYSNAME=`uname`
if [ "x$SYSNAME" = "xDarwin" ] ; then
LIBTOOLIZE=glibtoolize
fi
-aclocal && \
+aclocal -I m4 && \
autoheader && \
$LIBTOOLIZE && \
autoconf && \
View
@@ -22,7 +22,9 @@ fi
AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))
-
+AC_ARG_ENABLE(thread-support,
+ AS_HELP_STRING(--enable-thread-support, enable support for threading),
+ [], [enable_thread_support=yes])
AC_PROG_LIBTOOL
dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
@@ -351,6 +353,20 @@ AC_TRY_COMPILE([],
[Define to appropriate substitue if compiler doesnt have __func__])))
+# check if we can compile with pthreads for the unittests
+have_pthreads=no
+ACX_PTHREAD([
+ AC_DEFINE(HAVE_PTHREADS, 1,
+ [Define if we have pthreads on this system])
+ have_pthreads=yes])
+AM_CONDITIONAL(PTHREAD_REGRESS, [test "$have_pthreads" != "no"])
+
+# check if we should compile locking into the library
+if test x$enable_thread_support = xno; then
+ AC_DEFINE(DISABLE_THREAD_SUPPORT, 1,
+ [Define if libevent should not be compiled with thread support])
+fi
+
# Add some more warnings which we use in development but not in the
# released versions. (Some relevant gcc versions can't handle these.)
if test x$enable_gcc_warnings = xyes; then
View
@@ -67,6 +67,13 @@ struct event_base {
struct timeval event_tv;
struct min_heap timeheap;
+
+ /* threading support */
+ unsigned long th_owner_id;
+ unsigned long (*th_get_id)(void);
+ void (*th_lock)(int mode, int locknum);
+ int th_notify_fd[2];
+ struct event th_notify;
};
/* Internal use only: Functions that might be missing from <sys/queue.h> */
Oops, something went wrong.

0 comments on commit 558de9b

Please sign in to comment.