All operations on displayed CAPI elements need to be in the thread (that is, the
) that runs their interface. On some platforms,
make a new thread. On Cocoa, all interfaces run in a single thread.
In most cases this issue does not arise, because CAPI callbacks are run in the correct thread. However, if your code needs to communicate with a CAPI window from a random thread, it should use
to send the function to the correct thread.
This is why the brief interactive examples in this manual generally use
when modifying a displayed CAPI element. In contrast, the demo example in Connecting an interface to an application is modified only by callbacks which run in the demo interface's own process, and so there is no need to use
CAPI User Guide (Macintosh version) - 30 Aug 2011