1
0
Fork 0

OsmoCore: Start a poll process, stop it on code update..

This commit is contained in:
Holger Hans Peter Freyther 2010-09-11 01:49:40 +08:00
parent 9a8c9300d7
commit 1070089e90
1 changed files with 32 additions and 3 deletions

View File

@ -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
]