sqInt ioSetInputSemaphore(sqInt semaIndex)

sqInt semaIndex positive number which is the external index number for the squeak semaphore to signal

return: NONE, fake return of zero
but can set successFlag to make primitive fail.

From: Interpreter
Why: to set the event driven UI input semaphore

Track the input semaphore for signalling. Although this was added to the VM in the early days of the event driven VM changes it was not exploited by most platforms for semaphore signalling. The feeling was that because the VM was signal threaded and Morphic was polling every 1/60 why signal the semaphore? However the fact the semaphore was setup altered the basic processing of most VMs to place events into a circular FIFO event queue versus placing in a static area for later polling.

Note in conjunction with ioProcessEvents we would record the state of the mouse for polling, and place keystrokes in a FIFO circular buffer for later retrieval.

We attempt to signal this semaphore on input event processing. Earlier carbon VM, pre MacIntel ran Squeak as a worker thread, and the carbon event queue was another thread, so it was multi-threaded. We also used the fact if this was non-zero to ensure the polling state for ioPeekKeystroke, ioGetKeystroke, ioMousePoint, ioGetButtonState was correctly which was:
kEventRawKeyModifiersChanged create a kEventMouseMoved event

if semaIndex is zero record keystrokes or the fake wheel mouse move events into the old keyBuf circular queue

See iPhone

This is signalled when a touch event is turned into a compiex event. Same for acceleration, and location events.


Does not signal the semaphore, uses it to build new events, versus using older static variables, and queues

Some implementations do not signal the semaphore so the squeak event loop logic must poll.

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki