On Tue, 17 Jun 2008, Thorvald Natvig wrote:
It is straightforward enough, but it feels a bit like doing OO without OO.
Getting off-topic here, but I make a distinction between OO design and languages with "OO support". You can do OO programming style without having the "object->function" syntax. In case that makes you feel better about it ;-)
I can't simply override parts of the server and set a global variable; doing so would not be thread-safe.
How about using pthreads' support for thread-specific-data? see pthread_key_create(3). It's still a hack, but at least it's a threadsafe hack.
If you're using the non-blocking server this obviously won't work, but I imagine there's some concept of a "current context" that can have the equivalent of thread-local variables in libevent.
-Todd
