[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Help with progress thread



On Wed, Nov 10, 2010 at 9:58 AM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
>
> On Nov 9, 2010, at 9:57 PM, Nick Mathewson wrote:
>
>> On Tue, Nov 9, 2010 at 11:47 PM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
>>>
>>> On Nov 9, 2010, at 9:03 PM, Nick Mathewson wrote:
>> [...]
>>>> So I'm assuming that you've got all the threading callbacks set up
>>>> (probably via evthread_use_pthreads()) before you created the event
>>>> base, so that evthread_make_base_notifiable() was called on the
>>>> event_base when you created it.  If that's not the case, that's
>>>> probably the problem there.
>>>
>>> I missed that - this may well be my problem. Let me dig into this a little and get back to you.
>>>
>>> FWIW: I don't see myself drop out of the event loop when I add the event. In fact, just the opposite - I'm stuck in the loop and can't get out. So I'm not sure the bug mentioned below is accurate.
>>>
>>> Let me see what happens when I setup the event base for notification.
>>
>> To clarify, it should set itself up to be notifiable if you have
>> threading initialized before you create it.  (If you're going to
>> access an event_base from multiple threads, you MUST initialize
>> threading, or else there won't be any locks, and you'll be in a world
>> of race conditions.)
>>
>> Then again, calling evthread_make_base_notifiable() on an existing
>> event_base shouldn't hurt, since it's (supposed to be) idempotent.
>
> I'm confused - the function you cite requires an event base be passed to it:
>
> int evthread_make_base_notifiable(struct event_base *base);
>
> So how can I call it -before- I create the event base?

Initializing threading is not the same as making a base notifiable.
These are different things.

You need to initialize threading before you create the base.  That's
why you call evthread_use_pthreads().

Doing so should make the base get set up as notifiable.

If that doesn't work for some reason, you could try calling the
function to make the base notifiable.

HTH,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.