10-10-2013 10:57 AM
Hi all,
i am in need of some quidence, or an example of using the PostDeferredCall to pass multiple vaiables, or if it is even possible.
say for example i have a table and i want to recieve the eventdata1 and event data2 parameters from the event callback how do i send the two parameters in the function and then when i am in the deferred function extract the two parameters?
10-10-2013 01:45 PM
PostDeferredCall allows you to pass a pointer to the callback function. If you need to pass more than one item, the easiest solution is to create a structure that has all the items that you need contained in it, and pass the pointer to that structure to the deferred function callback (though, in your example you could just use an int array and pass the pointer to that). Note that when the deferred function executes, that structure must still exist in memory somewhere, so you can't just pass the memory address of a local variable. If you are going to have multiple deferred calls queued up at once, I've found it's best to malloc some memory for the structure, pass the pointer to the malloc'd memory, and then you can free it when you're done with it, possibly in the callback function itself. Hope this helps.