InputEventFetcher update
Hi, I'm working on the new startup/shutdown mechanism and I came to discover InputEventFetcher. What are the instruction to properly initialize / re-initialize the InputEventFetcher ? I tried InputEventFetcher deinstall; install and InputEventFetcher shutDown; deinstall; install; startUp but both end to an image not responding to mouse / keyboard events. Thanks for any help, Christophe
Tricky question :) In theory, just doing #startUp should be enough. But! Digging a bit you see that this code depends on the ExternalSemaphoreTable which uses an array of semaphores in the special objects array. unprotectedExternalObjects ^Smalltalk specialObjectsArray at: 39 So, before being able to work, the array at index 39 should be initialized. Which in theory can be done with ExternalSemaphoreTable>>clearExternalObjects "Clear the array of objects that have been registered for use in non-Smalltalk code." "Only lock additions, removals executing in parallel would have little effect on the resulting array" ProtectAdd critical: [ self unprotectedExternalObjects: Array new]. Tell me if that works, Guille
On 16 nov 2015, at 4:00 p.m., Christophe Demarey <Christophe.Demarey@inria.fr> wrote:
Hi,
I'm working on the new startup/shutdown mechanism and I came to discover InputEventFetcher.
What are the instruction to properly initialize / re-initialize the InputEventFetcher ? I tried InputEventFetcher deinstall; install and InputEventFetcher shutDown; deinstall; install; startUp
but both end to an image not responding to mouse / keyboard events.
Thanks for any help, Christophe
Le 16 nov. 2015 à 16:15, Guillermo Polito a écrit :
Tricky question :)
In theory, just doing #startUp should be enough.
for the snapshot:andQuit:, yes. But I'm also taking information for the bootstrap. It is good to know how to initialize the system ;)
But! Digging a bit you see that this code depends on the ExternalSemaphoreTable which uses an array of semaphores in the special objects array.
unprotectedExternalObjects ^Smalltalk specialObjectsArray at: 39
So, before being able to work, the array at index 39 should be initialized. Which in theory can be done with
ExternalSemaphoreTable>>clearExternalObjects "Clear the array of objects that have been registered for use in non-Smalltalk code." "Only lock additions, removals executing in parallel would have little effect on the resulting array"
ProtectAdd critical: [ self unprotectedExternalObjects: Array new].
When I run InputEventFetcher shutDown; startUp It works as expected. It looks like the problem is there if you try to install a new instance of InputEventFetcher. I do not get how eventHandlers inst. var is set in this case. fetcherProcess inst. var is initialized through #installEventLoop and inputSemaphore through #StartUp. Maybe it is the problem.
You mean how it is filled? Check InputEventSensor>>installEventSensorFramework: fetcherClass Itâs ugly but I think itâs there⦠newSensor registerIn: InputEventFetcher default. UserInterruptHandler new registerIn: InputEventFetcher default.
On 16 nov 2015, at 4:37 p.m., Christophe Demarey <Christophe.Demarey@inria.fr> wrote:
Le 16 nov. 2015 à 16:15, Guillermo Polito a écrit :
Tricky question :)
In theory, just doing #startUp should be enough.
for the snapshot:andQuit:, yes. But I'm also taking information for the bootstrap. It is good to know how to initialize the system ;)
But! Digging a bit you see that this code depends on the ExternalSemaphoreTable which uses an array of semaphores in the special objects array.
unprotectedExternalObjects ^Smalltalk specialObjectsArray at: 39
So, before being able to work, the array at index 39 should be initialized. Which in theory can be done with
ExternalSemaphoreTable>>clearExternalObjects "Clear the array of objects that have been registered for use in non-Smalltalk code." "Only lock additions, removals executing in parallel would have little effect on the resulting array"
ProtectAdd critical: [ self unprotectedExternalObjects: Array new].
When I run InputEventFetcher shutDown; startUp It works as expected.
It looks like the problem is there if you try to install a new instance of InputEventFetcher. I do not get how eventHandlers inst. var is set in this case. fetcherProcess inst. var is initialized through #installEventLoop and inputSemaphore through #StartUp. Maybe it is the problem.
ok, I got it. The class InputEventSensor registers eventHandlers in InputEventFetcher. The code to re-initilaize the EventFetcher is: InputEventFetcher deinstall; install. InputEventSensor installEventSensorFramework Le 16 nov. 2015 à 16:37, Christophe Demarey a écrit :
Le 16 nov. 2015 à 16:15, Guillermo Polito a écrit :
Tricky question :)
In theory, just doing #startUp should be enough.
for the snapshot:andQuit:, yes. But I'm also taking information for the bootstrap. It is good to know how to initialize the system ;)
But! Digging a bit you see that this code depends on the ExternalSemaphoreTable which uses an array of semaphores in the special objects array.
unprotectedExternalObjects ^Smalltalk specialObjectsArray at: 39
So, before being able to work, the array at index 39 should be initialized. Which in theory can be done with
ExternalSemaphoreTable>>clearExternalObjects "Clear the array of objects that have been registered for use in non-Smalltalk code." "Only lock additions, removals executing in parallel would have little effect on the resulting array"
ProtectAdd critical: [ self unprotectedExternalObjects: Array new].
When I run InputEventFetcher shutDown; startUp It works as expected.
It looks like the problem is there if you try to install a new instance of InputEventFetcher. I do not get how eventHandlers inst. var is set in this case. fetcherProcess inst. var is initialized through #installEventLoop and inputSemaphore through #StartUp. Maybe it is the problem.
Note that installEventSensorFramework: does a deinstall/install cycle of the old/new framework, so the explicit deinstall/install calls at the beginning are superfluous. IOW, for a bootstrap you only need InputEventSensor installEventSensorFramework Cheers, Henry
On 16 Nov 2015, at 4:43 , Christophe Demarey <Christophe.Demarey@inria.fr> wrote:
ok, I got it. The class InputEventSensor registers eventHandlers in InputEventFetcher. The code to re-initilaize the EventFetcher is: InputEventFetcher deinstall; install. InputEventSensor installEventSensorFramework
Le 16 nov. 2015 à 16:37, Christophe Demarey a écrit :
Le 16 nov. 2015 à 16:15, Guillermo Polito a écrit :
Tricky question :)
In theory, just doing #startUp should be enough.
for the snapshot:andQuit:, yes. But I'm also taking information for the bootstrap. It is good to know how to initialize the system ;)
But! Digging a bit you see that this code depends on the ExternalSemaphoreTable which uses an array of semaphores in the special objects array.
unprotectedExternalObjects ^Smalltalk specialObjectsArray at: 39
So, before being able to work, the array at index 39 should be initialized. Which in theory can be done with
ExternalSemaphoreTable>>clearExternalObjects "Clear the array of objects that have been registered for use in non-Smalltalk code." "Only lock additions, removals executing in parallel would have little effect on the resulting array"
ProtectAdd critical: [ self unprotectedExternalObjects: Array new].
When I run InputEventFetcher shutDown; startUp It works as expected.
It looks like the problem is there if you try to install a new instance of InputEventFetcher. I do not get how eventHandlers inst. var is set in this case. fetcherProcess inst. var is initialized through #installEventLoop and inputSemaphore through #StartUp. Maybe it is the problem.
participants (3)
-
Christophe Demarey -
Guillermo Polito -
Henrik Johansen