Skip to content
Tcl Source Code Artifact [2978d55d53]
Login

Artifact [2978d55d53]

Artifact 2978d55d5333d0ffe1906f49a0c641eb6b696c24:

Wiki page [Notifier] by dgp on 2014-10-25 15:56:37.
D 2014-10-25T15:56:37.533
L Notifier
P e2cd94e91b312a7c11d5a48e164e517e6fd3ad9b
U dgp
W 2574
<h1>Source Files</h1>
  *  [/finfo?name=generic/tclNotify.c|tclNotify.c]
  *  [/finfo?name=macosx/tclMacOSXNotify.c|tclMacOSXNotify.c]
  *  [/finfo?name=unix/tclUnixNotfy.c|tclUnixNotfy.c]
  *  [/finfo?name=win/tclWinNotify.c|tclWinNotify.c]

<h1>Public Interface</h1>
  *  Tcl_SetNotifier
  *  Tcl_CreateEventSource
  *  Tcl_DeleteEventSource
  *  Tcl_QueueEvent
  *  Tcl_ThreadQueueEvent
  *  Tcl_DeleteEvents
  *  Tcl_ServiceEvent
  *  Tcl_GetServiceMode
  *  Tcl_SetServiceMode
  *  Tcl_SetMaxBlockTime
  *  Tcl_DoOneEvent
  *  Tcl_ServiceAll
  *  Tcl_ThreadAlert
  *  Tcl_Sleep

<h1>Private Interface</h1>
  *  TclInitNotifier
  *  TclFinalizeNotifier
  *  TclMacOSXNotiferAddRunLoopMode
  *  TclUnixWaitForFile

<h1>Driver Interface</h1>
  *  Tcl_SetTimer
  *  Tcl_WaitForEvent
  *  Tcl_CreateFileHandler
  *  Tcl_DeleteFileHandler
  *  Tcl_InitNotifier
  *  Tcl_FinalizeNotifier
  *  Tcl_AlertNotifier
  *  Tcl_ServiceModeHook

<h1>Directly Depends On Public Interface</h1>
  *  [Allocation]
  *  [Threads]
  *  [Panic]
  *  [Asynchronous Events]
  *  [Time Measurement]

<h1>Directly Depends On Private Interface of</h1>
  *  [Timer Events]
  *  [Time Measurement]
 
<h1>Discussion</h1>

The dependence on private aspect of [Time Measurement] is the
direct access of the <b>tclScaleTimeProcPtr</b> which could be
avoided by use of <b>Tcl_QueryTimeProc</b>.

The three modules [Notifier], [Asynchronous Events], and [Timer Events]
appears to be an indivisible, interdependent collection.

The extension/customization feature provided by <b>Tcl_SetNotifier</b>
has a very convoluted implementation.  Refactoring to something more like
that used by <b>Tcl_SetTimeProc</b> appears to be feasible, with only
compatibility impacts on the [Xt Based Notifier] which I can find no evidence
of being used by anyone for anything.

The default notifier on unix is founded on the <b>select()</b> system call.
This implementation brings with it a limitation of <b>FD_SETSIZE</b>.  Besides
that, <b>select()</b> has a reputation of being an <i>old</i> choice, and
many programmers are curious why more recent mechanisms are not used.
Other candidates include <b>poll()</b> or <b>libevent</b>.  It seems the way forward is to
patch up any defects in <b>Tcl_SetNotifier</b> so that a notifier can be
selected at program startup, and continue to supply the <b>select</b> implementation
(for portability to weird places like routers) while also supplying whatever
new notifiers make sense on respective platforms.
Z 604138730023369749a811694473bcc6