Re: [Libevent-users] Implementing a deadline timer

2008-10-09 Thread Christopher Layne
On Tue, Sep 09, 2008 at 04:48:40PM -0500, Andrew Troschinetz wrote: Hi all, I'm just getting started with libevent and I was wondering how I might implement a simple deadline timer with it. I'd like to be able to use do something like: void do_something(...) ...

[Libevent-users] [PATCH] relative timer with EV_PERSIST support + move event_del logic into event_active + regression tests

2007-11-13 Thread Christopher Layne
1. Make EV_PERSIST reschedule timeouts automatically. 2. New function: timeout_schedule: (nothing really new within it, just modular wrapping of timeout rescheduling). 3. New macro: evutil_timercpy: tv_dst = tv_src in one line type deal; 3. Regression tests for persistent timeouts, include

Re: [Libevent-users] [PATCH] relative timer with EV_PERSIST support + move event_del logic into event_active + regression tests

2007-11-13 Thread Christopher Layne
On Tue, Nov 13, 2007 at 06:27:58PM -0800, William Ahern wrote: event_set(ev, fd, EV_READ | EV_PERSIST, read_cb, obj); event_add(ev, timeout); read_cb() will be called whenever a read event happens, and it's timeout as passed to event_add() will be reset to the original value you

[Libevent-users] [PATCH] test/Makefile.am: out of srcdir fix

2007-11-11 Thread Christopher Layne
Index: test/Makefile.am === --- test/Makefile.am(revision 515) +++ test/Makefile.am(working copy) @@ -31,6 +31,6 @@ test: test-init test-eof test-weof test-time regress verify: test - @./test.sh +

[Libevent-users] [PATCH] event.c: timeout_process(): let event_del() handle queue management

2007-11-11 Thread Christopher Layne
event_del() calls event_queue_remove(base, ev, EVLIST_TIMEOUT). -cl Index: event.c === --- event.c (revision 515) +++ event.c (working copy) @@ -815,7 +815,6 @@ while ((ev = min_heap_top(base-timeheap))) {

Re: [Libevent-users] [OT] craigslist: libevent programmer wanted

2007-11-11 Thread Christopher Layne
On Mon, Nov 12, 2007 at 06:38:33AM +0100, Marc Lehmann wrote: On Fri, Nov 09, 2007 at 12:39:37AM +0100, Hannah Schroeter [EMAIL PROTECTED] wrote: I see less problems with the writing away of the data sucked from the web servers, as most Unix like systems write stuff asynchronously, so the

[Libevent-users] [PATCH] signal.c: debug cleanups

2007-11-10 Thread Christopher Layne
1. Fix a debugging call with wrong format, (we should probably use __attr__((format(printf))) eventually). 2. Add additional debugging calls for sanity. -cl Index: signal.c === --- signal.c(revision 507) +++ signal.c(working

[Libevent-users] [PATCH] event.c: make internal signal event count as active

2007-11-10 Thread Christopher Layne
[ WARNING: Long and ardorous - difficult to trace behaviour ] Behaviour described is without EV_PERSIST on internal signal handler (as it's been for months): 1. signal comes in, we jump to our internal signal handler, it writes to pipe. 2. epoll_wait() returns -1/EINTR because a signal handler

Re: [Libevent-users] [PATCH] event.c: make internal signal event count as active

2007-11-10 Thread Christopher Layne
On Sat, Nov 10, 2007 at 06:44:12PM -0800, Christopher Layne wrote: 11. here's the funny part: evsignal_process() increments event_count_active - but since our should be: evsignal_process() adds the internal event to the active queue as normal. before we call event_process_active

Re: [Libevent-users] [PATCH] event.c: make internal signal event count as active

2007-11-10 Thread Christopher Layne
On Sat, Nov 10, 2007 at 06:49:58PM -0800, Christopher Layne wrote: On Sat, Nov 10, 2007 at 06:44:12PM -0800, Christopher Layne wrote: 11. here's the funny part: evsignal_process() increments event_count_active - but since our Here's a better patch: This removes docount entirely. docount

Re: [Libevent-users] [PATCH] signal.c, evsignal.h: properly save/restore previous signal handlers and fix memory stomp

2007-11-09 Thread Christopher Layne
On Fri, Nov 09, 2007 at 04:03:46PM -0800, Scott Lamb wrote: Christopher Layne wrote: +/* save previous handler setup */ +if (sigaction(evsignal, NULL, sig-sa_old[evsignal]) == -1 +|| sigaction(evsignal, sa, NULL) == -1) Not worth changing unless you're redoing the patch

[Libevent-users] [PATCH] sample/Makefile.am: additional include

2007-11-09 Thread Christopher Layne
Separate build dir issue. Index: sample/Makefile.am === --- sample/Makefile.am (revision 506) +++ sample/Makefile.am (working copy) @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies LDADD = ../libevent.la -AM_CFLAGS =

Re: [Libevent-users] sensible thread-safe signal handling proposal

2007-11-04 Thread Christopher Layne
On Sun, Nov 04, 2007 at 12:15:56PM -0800, Steven Grimm wrote: On Nov 4, 2007, at 8:13 AM, Marc Lehmann wrote: This would create additional loops (event_bases). The difference is that these cannot handle signals (or child watchers) at all, with the default loop being the only one to do

Re: [Libevent-users] announcing libev, towards a faster and more featureful libevent

2007-11-04 Thread Christopher Layne
On Mon, Nov 05, 2007 at 02:42:16AM +0100, Marc Lehmann wrote: On Sun, Nov 04, 2007 at 05:19:36PM -0800, Christopher Layne [EMAIL PROTECTED] wrote: Not to put on my O-face, but binary heap insert is *average* O(1). There should be a performance win for libevent, when it comes to timer

Re: [Libevent-users] announcing libev, towards a faster and more featureful libevent

2007-11-04 Thread Christopher Layne
On Mon, Nov 05, 2007 at 02:46:36AM +0100, Marc Lehmann wrote: On Sun, Nov 04, 2007 at 04:09:08PM -0800, Scott Lamb [EMAIL PROTECTED] wrote: Have you seen the new Linux timerfd API? Where available, you can wait for CLOCK_MONOTONIC and CLOCK_REALTIME events independently. Beats heuristics,

Re: [Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-11-03 Thread Christopher Layne
On Sat, Nov 03, 2007 at 04:56:07PM -0700, Niels Provos wrote: Try #include sys/queue.h before including evhttp.h Niels. Why is this a usercode issue? Shouldn't evhttp.h be more interested in handling it's dependencies than non-event parent code? It's similar to the sys/time.h being a

Re: [Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-11-03 Thread Christopher Layne
On Sat, Nov 03, 2007 at 05:53:42PM -0700, Niels Provos wrote: Well, Rob Pike has many great insights. He also does not like conditional compilation. However, you are right, evhttp.h could resolve the dependency on queue.h internally. I will look into it. Agreed, Rob Pike is true blue - and

Re: [Libevent-users] [PATCH] Add autoconf/make functionality for --disable-dns, --disable-http, and --disable-bevents

2007-09-27 Thread Christopher Layne
On Thu, Sep 27, 2007 at 08:31:32AM -0700, Niels Provos wrote: Hi Christopher, I am not sure if this is necessarily the right way to go for a library, esp if it can impact backwards compatibility for bufferevents. As for reducing the size of the library, do you really think that 30K make a

[Libevent-users] [PATCH] Add autoconf/make functionality for --disable-dns, --disable-http, and --disable-bevents

2007-09-26 Thread Christopher Layne
$ ./configure --help [...] Optional Features: [...] --enable-dnsbuild with support for dns layer [default=yes] --enable-http build with support for http layer [default=yes] --enable-beventsbuild with support for buffer events [default=yes] Changes: 1. This

Re: [Libevent-users] [PATCH] Do not call gettime in timeout_process if the timetree is empty

2007-09-20 Thread Christopher Layne
On Thu, Sep 20, 2007 at 01:52:31PM +0200, Trond Norbye wrote: The result of gettime is not used if the timetree is empty (and might cause a context switch to get the system clock). --Trond Index: event.c === --- event.c

[Libevent-users] [PATCH] test/Makefile.am: Correct a relative path issue

2007-09-18 Thread Christopher Layne
1. event_rpcgen.py will fail to open regress.rpc if building outside the source directory. -cl -- Index: Makefile.am === --- Makefile.am (revision 433) +++ Makefile.am (working copy) @@ -18,7 +18,7 @@ bench_SOURCES = bench.c

[Libevent-users] [PATCH] http.c build errors and a segfault (USE_DEBUG only)

2007-09-15 Thread Christopher Layne
Compilation errors in http.c and a segfault during make verify when USE_DEBUG is defined. Index: libevent/http.c === --- libevent/http.c (revision 429) +++ libevent/http.c (working copy) @@ -1174,7 +1174,7 @@ if

Re: [Libevent-users] [PATCH] initialize ev_res

2007-08-04 Thread Christopher Layne
On Thu, Jul 19, 2007 at 01:14:58PM -0700, Scott Lamb wrote: When I use valgrind --tool=memcheck on a libevent-based program, it gives the following complaint: ==15442== Conditional jump or move depends on uninitialised value(s) ==15442==at 0x4C0F2D3: event_add (event.c:632) ==15442==

Re: [Libevent-users] EV_PERSIST behavior

2007-05-08 Thread Christopher Layne
On Tue, May 08, 2007 at 06:38:51PM -0700, William Ahern wrote: received a non-timeout event. In a way this is absolute, not in the epoch sense, but that it's tied to the time event_add() was called and not relative to when the last valid event was received. That may or may not make