Dangal Full Movie Streaming. Dangal Full Movie Download. Dangal Tamil Full Movie Download. Dangal full movie hd subtitles.Q:
How to unregister event handler in event queue without polluting the event queue?
I'm writing a server application which is receiving messages and has an event queue which contains a list of messages that are in the process of being processed. I'd like to cancel some of the message processing and free up some of the resources associated with the processing, but still be sure that the messages which have been processed will not be processed again.
I tried calling EventLoop.cancel_events() but my application loses the messages it's currently processing in the event queue.
Is there a way to remove a single event from the queue without removing all events from the queue?
The normal way to do that is to have a flag that tells the event loop to skip the handler for that event (by setting the passed flag to true). This can be done by passing a flag to next_tick or poll, so that the native event loop doesn't create the original event, pass it through the callback and then handle it again.
The next problem is that the libevent API returns true when you try to call cancel_event_loop() (and any of the variants where the flag is set to true). That means that the first iteration of next_tick/poll will not get to run and your application will not be able to process events until it is restarted. That is not what you want, so you will need to make sure that you can tell the event loop not to ignore your flag.
One way to do that is to make a copy of the flag and return it unchanged in the callback (although if it was true, you have done nothing wrong).
If you don't need to preserve the order of the messages, you can go a step further and pass the flag to the callback explicitly. I.e.:
void my_callback(struct event_base *base, evutil_socket_t fd, short what, void *arg)
struct my_event * e = arg;
if (! e->skip)
And then when you create the callback, set it to skip the message: