[fpc-pascal] QueueUserAPC Similar Cross platform Functionality
Andrew Brunner
andrew.t.brunner at gmail.com
Thu Oct 8 19:34:54 CEST 2009
Hi there,
I've got a unit I'm porting from Windows to Linux and I came across a
QueueUserAPC (Kernel32 Windows) I make to add a callback method that
gets executed by the thread I added this to.
function QueueUserAPC(Callback: Pointer; hThread: THandle;
dwData:DWORD): boolean; stdcall;
When the Thread gets around to it, it processes the callback function
I passed in during the queue call.
Judging by the performance of this method I would say that the Windows
Kernel maintains a queue of events to process for each thread. And
this function allows me to attach a callback to that queue so I can
allocate memory within that stack rather than the stack of the calling
thread. This feature is important as I want to keep memory allocation
to specific threads.
Does Threading under Linux have anything like this? Have any of you
done anything like this under *nix?
Thanks for any feedback.
More information about the fpc-pascal
mailing list