[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Destroying event from callback function
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] Destroying event from callback function
- From: Michał Król <mharnen@xxxxxxxxx>
- Date: Thu, 7 Apr 2011 09:53:23 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Thu, 07 Apr 2011 03:53:30 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=6bXylPAcFJhAo/ZEAsnQNFJQf9TjrOpiVj/4+SQTY94=; b=q3hpBE7fT4czjHqW6mySqFF3H1stuFcGLShfg/lBqe0fdcjVCpNz8q+TK6mRJMwqbN 8ZnXXuOvxQSKS8NqX3AAWSS19VwyX7OJEMLSGj8hVc4Gbc1DIV6nAnQPEW2gkto0vhAA VyMAUEmYQAuAz4iL+1P+q++ivt+jl93rW1SFI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HWmlC2q+qBAQcA9+2TzFJbxsxKu6HIKB5PXYDX2wDJq+voPGFoXj5vuY7Tsus8uf1j dZt/hbNgqWcTd42ANVX1M4q1f9k2FJszePNsGXPpKasdJJwc6DaPQYNA46JnlylYjfm3 lahrcOjBFKhjSRwqVSWN4GkISCNCjKHs91Tmo=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hi,
I was wondering if there is any way I can access event object within callback function in libevent2? I know I can put it in global variable, but I'll have a lot of events and I want to access particular one, so I want to avoid it.
I cannot pass it as an argument because I'll have pointer to event structure after setting callback in evet_new.
To be precise I want to do something like this:
int main(){
event = event_new(base, socket, flags, cb_func, args);
event_add(event);
}
void cb_func(args){
//do some work
event_del(event); <-- the problem is with getting event structure which invoked this callback }
Thanks in advance
Michal