Answered by:

WinRT - How to properly handle a C lib async callback

Question

I am porting a C library to a WinRT component. The C lib implements asynchronous callbacks. The model is you call a said synchronous function, and during the execution the asynchronous callback is called n times. Once the synchronous
function exits the asynchronous callback will not be called. So what is the best way to handle this? Do I need to redesign the C library such that I use parallel tasks as per most of the examples I have found, or can I asynchronously
update the UI thread. It seems to me the UI thread blocks on the WinRT method call. Thanks!

All replies

>> The model is you call a said synchronous function, and during the execution the asynchronous callback is called n times.Once the synchronous function exits the asynchronous callback will not be called.

I’m not sure whether I understand your requirement correctly, do you mean the synchronous function needed to wait all of the callbacks completing before exiting?

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.