Thanks for your reply, Mark.First of all, I'd like to clarify, if maybe I did not make it clear, but I'm using a custom threading library built on top of Qt. So I'm not quite sure if I use evthread_use_windows_threads() *IN CONJUNCTION WITH* evthread_set_id_callback, evthread_set_condition_callbacks, and evthread_set_lock_callbacks. I figured if I'm going to be using a custom thread library that I'd use neither evthread_use_windows_threads nor evthread_use_posix_threads.Secondly, I took your suggestion and called evthread_use_windows_threads() as the first thing I do and it still crashed. I am attaching the code below.Perhaps as a sanity check, it would be nice if someone would at least say "yes/no evhttp was/wasn't meant to be used in the way you're using it"Thanks,-Julianevthread_use_windows_threads();...evthread_set_id_callback(&EvThread::id_fn);evthread_condition_callbacks cond_cbs;cond_cbs.condition_api_version = 1.0;cond_cbs.alloc_condition = &EvWaitCond::alloc_condition;cond_cbs.free_condition = &EvWaitCond::free_condition;cond_cbs.signal_condition = &EvWaitCond::signal_condition;cond_cbs.wait_condition = &EvWaitCond::wait_condition;evthread_set_condition_callbacks(&cond_cbs);evthread_lock_callbacks lock_cbs;lock_cbs.lock_api_version = 1.0;lock_cbs.supported_locktypes = EVTHREAD_LOCKTYPE_RECURSIVE;lock_cbs.alloc = &EvLock::alloc;lock_cbs.free = &EvLock::free;lock_cbs.lock = &EvLock::lock;lock_cbs.unlock = &EvLock::unlock;evthread_set_lock_callbacks(&lock_cbs);====================On Wed, Jun 27, 2012 at 12:42 PM, Mark Ellzey <mthomas@xxxxxxxxxx> wrote:
On Wed, Jun 27, 2012 at 02:37:22PM -0500, Mark Ellzey wrote:Let me reiterate, you first have to call one of the above functions
> On Wed, Jun 27, 2012 at 11:02:04AM -0700, Julian Bui wrote:
> > Hi libevent,
> >
> > Sorry for the recent surge of emails. I am trying to determine the cause
> > of a problem in my application while using evhttp. I wrote a toy/dummy
> > server (whose code I included) that exhibits the same problem that my real
> > application is having.
> >
> > PROBLEM OVERVIEW:
> >
> > My application is using ev_http and I set its gencb (handles any request
> > that comes in) to a function that just validates that there's a path or
> > query. If a path or query exists, the evhttp_request*, path, and query are
> > handed off to one thread which processes the request one at a time. This
> > thread is calling evhttp_send_reply or evhttp_send_error when done with the
> > request.
> >
> > The problem is that when I hit my server through the browser and hit
> > refresh to constantly send it requests, it crashes. In the debugger, I see
> > it crashes on the evhttp_send_reply line and the error reads: "exception at
> > 0x____ in ____.exe, 0xC0000005: Access violation reading location
> > 0xdddddee5" none of the parameters going into this method are NULL.
> >
>
> I don't see either evthread_use_pthreads() or
> evthread_use_windows_threads() being used before setting up any events.
> Try putting that at the top of your main function before anything else
> and compile with -levent_threads
*before* setting evthread_set_lock_callbacks, evthread_set_id_callback,
and evthread_set_condition_callbacks.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.