OsmoCore: Start a poll process, stop it on code update..
This commit is contained in:
parent
9a8c9300d7
commit
1070089e90
35
OsmoCore.st
35
OsmoCore.st
|
@ -1,11 +1,42 @@
|
|||
"Copyright placeholder"
|
||||
|
||||
Eval [
|
||||
"Handle reloading the OsmoCore.st file for updates"
|
||||
Namespace current at: #OSMOCore ifPresent: [ :each | OSMOCore stopProcess ].
|
||||
]
|
||||
|
||||
Object subclass: OSMOCore [
|
||||
<comment: 'I provide lowlevel access libosmocore.so.0'>
|
||||
<category: 'libosmocore'>
|
||||
|
||||
Process := nil.
|
||||
|
||||
OSMOCore class >> initialize [
|
||||
DLD addLibrary: 'libosmocore.so.0'.
|
||||
ObjectMemory addDependent: self.
|
||||
]
|
||||
|
||||
OSMOCore class >> startProcess [
|
||||
"I start a new polling process"
|
||||
| delay |
|
||||
delay := Delay forMilliseconds: 500.
|
||||
|
||||
Process := [
|
||||
[true] whileTrue: [
|
||||
self bsc_select_main: 1.
|
||||
" delay wait."
|
||||
].
|
||||
] fork.
|
||||
]
|
||||
|
||||
OSMOCore class >> stopProcess [
|
||||
"I will terminate the process"
|
||||
Process ifNotNil: [
|
||||
Process terminate.
|
||||
Process := nil.
|
||||
]
|
||||
]
|
||||
|
||||
OSMOCore class >> update: aSymbol [
|
||||
"Check if the BSC Symbols are there again?"
|
||||
]
|
||||
|
@ -20,7 +51,5 @@ Object subclass: OSMOCore [
|
|||
|
||||
Eval [
|
||||
OSMOCore initialize.
|
||||
|
||||
"TODO: start process that is going to poll... but make sure it is
|
||||
only one doing that..."
|
||||
OSMOCore startProcess
|
||||
]
|
||||
|
|
Reference in New Issue