I'm implementing threading in Metro mode, I got this example while Googling, but I don't understand CallbackContext
. What's the use of this? This explains its use in MTA, but not clear to me. And I'm facing problem when I use CallbackContext
as Any
or Same
. Something work with one but not with other! So first thing first I want to know what's the use of this?! PS: I'm new to WindowsRT programming and C++ too! Thanks!
auto workItemHandler = ref new WorkItemHandler([=](IAsyncAction^)
{
// Run the user callback.
try
{
func(data);
}
catch (...)
{
}
// Signal that the thread has completed.
SetEvent(completionEvent);
//CloseHandle(completionEvent);
}, CallbackContext::Same);