Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I notice that while ISocket has a Cancel() method for cancelling pending callbacks, IAddrInfo doesn't. What's the best way of dealing with my application having to exit with a query pending? Do I just Release the IAddrInfo?

Also, once StartQuery() has returned successfully, is it now guaranteed that my callback will either fire or its cancel function will fire? What I'm worried about here is the situation where the callback has been posted to the event queue while my application is in the process of exiting; obviously I can't free the memory associated with the callback's user pointer until I know the callback won't be needing it...

The callback registered with IAddrInfo is set up with CALLBACK_Init and you can use CALLBACK_Cancel to cancel the callback. Please see the documentation for AEECallback in the API reference guide for more details.
 
IAddrInfo_StartQuery is a asynchronous call if you supply a callback, in which case AEE_SUCCESS is returned only to indicate that the DNS query has been successfully initiated and you need to expect the callback to be invoked for the results.
If you don't supply a callback (passing NULL instead), IAddrInfo_StartQuery will be a synchronous call and only if the query result is immediately available on the device (no networking calls) will it return AEE_SUCCESS.

The callback registered with IAddrInfo is set up with CALLBACK_Init and you can use CALLBACK_Cancel to cancel the callback. Please see the documentation for AEECallback in the API reference guide for more details.
 
IAddrInfo_StartQuery is a asynchronous call if you supply a callback, in which case AEE_SUCCESS is returned only to indicate that the DNS query has been successfully initiated and you need to expect the callback to be invoked for the results.
If you don't supply a callback (passing NULL instead), IAddrInfo_StartQuery will be a synchronous call and only if the query result is immediately available on the device (no networking calls) will it return AEE_SUCCESS.

I have been looking at that documentation --- it's not very clear. In particular, there's no discussion of the callback state machine. I particularly need to know whether cancelling the callback is guaranteed to ensure that the callback will never run. Some callback systems can only cancel callbacks before they get posted to the event queue, so that the application code has to be able to deal with stray callbacks. Does Brew work like this?

I have been looking at that documentation --- it's not very clear. In particular, there's no discussion of the callback state machine. I particularly need to know whether cancelling the callback is guaranteed to ensure that the callback will never run. Some callback systems can only cancel callbacks before they get posted to the event queue, so that the application code has to be able to deal with stray callbacks. Does Brew work like this?

When you invoke CALLBACK_Cancel(), you can be assured that the callback will be removed, and it will never run.
 
Please let me know if this does not fully answer your question.

When you invoke CALLBACK_Cancel(), you can be assured that the callback will be removed, and it will never run.
 
Please let me know if this does not fully answer your question.