From: Michiel de H. <mjl...@ya...> - 2013-09-07 09:46:53
|
Hi all, I am trying to understand how Tcl_SetNotifier works for the mac. I understand the Tcl_SetNotifier effectively lets me replace these functions: Tcl_SetTimer Tcl_WaitForEvent Tcl_CreateFileHandler Tcl_DeleteFileHandler Tcl_InitNotifier Tcl_FinalizeNotifier Tcl_AlertNotifier Tcl_ServiceModeHook Now if I look in macosx/tclMacOSXNotify.c, I see that these functions make use of a local ThreadSpecificData *tsdPtr, which is initialized by Tcl_InitNotifier. However, Tcl_Sleep also makes use of the same tsdPtr, but Tcl_Sleep is not part of the notifier. So how can this work? If I replace the notifier by Tcl_SetNotifier, then Tcl_InitNotifier is replaced by my own function. Then if Tcl_Sleep is called, it will access tsdPtr, which was never initialized properly, as it should have been initialized by the original Tcl_InitNotifier. Is this a bug, or am I misunderstanding something? Thanks, -Michiel. |