[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Clarify new behavior?
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Clarify new behavior?
- From: Nick Mathewson <nickm@xxxxxxxxxxxxx>
- Date: Tue, 26 Oct 2010 22:16:30 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Tue, 26 Oct 2010 22:16:36 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=3oQVhwFrC/zyi2QsDZsLPhwom53GtEZ1kcsEwF+aHmk=; b=aLWuuhrIbAHUvOsm0LLdgRosvPTLYjrBYAdsGMF+9y4lpSxXhiwGzxEs9y15iiWALZ DYvlE4RuleyB3c8q8mqRQbvfK+mzbBX0paLbk0ORaW2V2xadsrkDv0pIJztfaQEtBEc2 B7eNvsUxve4Xs09k1NWQhKcHeNARWGTVl4RLQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=XeeAinEBdWbvmBq91O+3cQzviagBEzSCLBkOcqa+DVwxhwawvRsit2c71DKDkoWtcT agbE0Pr6mnrp5L7xh+ImbjBoD998DQTODycp8DwrZ3J5F6BV949SHf1DKXbS7SaIYAch RMPmrIWCNmKa/v0ZamgUjYjb9jkoVo9Bw0z28=
- In-reply-to: <84BF290C-2C9E-4AB1-A969-0050F74D681E@xxxxxxxxxxxx>
- References: <84BF290C-2C9E-4AB1-A969-0050F74D681E@xxxxxxxxxxxx>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
On Sat, Oct 23, 2010 at 5:14 AM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
> Hi folks
>
> I successfully updated our libevent integration in Open MPI, but have encountered a problem with one use-case that used to work and now doesn't. Before proceeding to devise a fix, I just wanted to confirm that I accurately understand the issue.
>
> The problem arises from this scenario:
Hi, Ralph! I'm going over this again to try to figure out what to do.
I think that the short term answer, since you're already shipping a
patched libevent, and you aren't calling event_base_dispatch on a
single base from more than thread at once, is for you to remove the
entire "if" block that checks for reentrant invocation, warns, and
returns. If the behavior you get now works for you, that's probably a
fine workaround for now. I am pretty sure that it was never actually
planned to work as it does, but there's no sense in you rewriting your
code for future 2.1 semantics until they are nailed down. (And
there's not much chance of the semantics of reentrant event_base_loop
invocation getting settled in a 2.0 timeframe IMO).
That said, I want to ask you a few questions about your use case to
see if this is actually the best way for Libevent to do what you need,
or if there's some other piece of functionality that could let you
implement what you want more cleanly.
>
> 1. we receive a command via a message that we receive in a file descriptor event. We "push" the command message into a timer event (duration zero time) to help break a threading issue, and then return from the file descriptor event.
So I'm confused here. You say "to break a threading issue", but in a
later message you say "After all, we are running single-threaded".
Also, I'm assuming you know about event_active() and dummy events
(fd=-1, events=0), and that you're using this zero-duration timeout
trick for some other reason. Why, and should there be a better way to
do that?
> 2. the event library is called with LOOP_ONCE, causing the timer event to fire.
>
> 3. from within the timer event, the command causes us to execute a procedure that results in us having to wait for another event to occur. We "block" in that position, running a loop that includes a call to progress the event library (i.e., a call to event_loop(LOOP_ONCE)).
But, why with the same event_base? That's the part that confuses me.
When you block in the callback invoked in 3, you stop executing _all_
other active event callbacks that might be waiting to execute. Then
later the first time you call event_loop once, you run them. Was
that what you had in mind? I am not getting the architecture here.
Maybe some pseudocode would make me understand. :/
yrs,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.