Gilles Roy
|
Re: How to wait for mme events in code?
|
Gilles Roy
10/27/2009 2:10 PM
post40825
|
Re: How to wait for mme events in code?
> I'm wondering how to best wait for MME events in my code using mme_get_event.
> Is there a way to block until events are delivered or must I set up a timer as
> outlined in the MME Dev Guide in ch. 2? In the latter case, how to identify a
> suitable interval at which to trigger?
If you call mme_get_event() and there is no event waiting, you get a false event back with type MME_EVENT_NONE. You
can't just block on the call.
The timer example is misleading, I don't think it is needed. If you talk about blocking, then you probably have a
dedicated thread for event processing. In this case you can setup an event (say a pulse) and then register that event
with the MME. Then the thread can just enter a loop where it call mme_get_event() until MME_EVENT_NONE is returned, then
the thread waits in MsgReceivePulse until it gets a pulse from the MME. Note that the thread should have a dedicated
mme connection since you can't shared handle mme_connect() returns among threads. Or rather, you can share it, but you
can't have two threads call into the MME at once using the same mme handle.
Regards,
Gilles
|
|
|
Dan Cardamore(deleted)
|
Re: How to wait for mme events in code?
|
Dan Cardamore(deleted)
10/27/2009 3:29 PM
post40834
|
Re: How to wait for mme events in code?
Take a look at the mme_register_for_events( ) function which allows you to get notified when one or more events have
been queued for you to recieve. You can also look at mmecli.c for an example.
|
|
|
Thomas Junge(deleted)
|
Re: How to wait for mme events in code?
|
Thomas Junge(deleted)
10/28/2009 8:36 AM
post40869
|
Re: How to wait for mme events in code?
Thanks Gilles,
your proposal of using MsgReceivePulse to wait works.
@Dan: I already had that part correct, it was just how to make it behave blocking rather than a busy-loop :-)
Cheers,
Thomas
|
|
|