added more code for process scheduling
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#class Boolean(Object)
|
||||
{
|
||||
|
||||
"TODO: do i need to really define methods defined in True and False here?
|
||||
and call subclassResponsibiltiy?"
|
||||
}
|
||||
@ -75,7 +74,6 @@
|
||||
^aBlock value
|
||||
}
|
||||
|
||||
|
||||
#method ifTrue: trueBlock ifFalse: falseBlock
|
||||
{
|
||||
^falseBlock value.
|
||||
|
@ -42,13 +42,14 @@
|
||||
#method fork
|
||||
{
|
||||
"crate a new process in the runnable state"
|
||||
## TODO
|
||||
^self newProcess resume.
|
||||
}
|
||||
|
||||
#method newProcess
|
||||
{
|
||||
"create a new process in the suspended state"
|
||||
## TODO
|
||||
<primitive: #_block_new_process>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
#method newProcessWith: anArray
|
||||
|
@ -1,6 +1,6 @@
|
||||
#class(#pointer) Process(Object)
|
||||
{
|
||||
#dcl sp state prev next.
|
||||
#dcl context state prev next.
|
||||
|
||||
#method prev
|
||||
{
|
||||
@ -21,6 +21,12 @@
|
||||
{
|
||||
self.prev := aProcess.
|
||||
}
|
||||
|
||||
#method resume
|
||||
{
|
||||
^Scheduler resume: self.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#class ProcessScheduler(Object)
|
||||
@ -56,12 +62,22 @@
|
||||
].
|
||||
}
|
||||
|
||||
#method resume: aProcess
|
||||
{
|
||||
self add: aProcess.
|
||||
self.active := aProcess.
|
||||
}
|
||||
|
||||
#method remove: aProcess
|
||||
{
|
||||
"<primitive: #_scheduler_remove>"
|
||||
|
||||
"TODO: "
|
||||
}
|
||||
|
||||
#method suspendActive
|
||||
{
|
||||
" TODO: .........."
|
||||
}
|
||||
|
||||
"
|
||||
|
@ -241,9 +241,16 @@
|
||||
ffi close.
|
||||
"
|
||||
|
||||
self abc.
|
||||
self abc.
|
||||
self abc.
|
||||
| p |
|
||||
'000000000000000000' dump.
|
||||
p := [ 'xxxxxxxxxxxxxxxxx' dump. 'yyyyyyyyyyyyyyyyyyyyyyyyyy' dump. ] newProcess.
|
||||
'999999999999999999' dump.
|
||||
p resume.
|
||||
|
||||
'111111111111111111' dump.
|
||||
'222222222222222222' dump.
|
||||
'333333333333333333' dump.
|
||||
'444444444444444444' dump.
|
||||
|
||||
"
|
||||
FFI isNil dump.
|
||||
|
Reference in New Issue
Block a user