added some more code for processing scheduling

This commit is contained in:
hyunghwan.chung
2015-10-19 06:16:43 +00:00
parent 3482c99ab7
commit 96011578c8
6 changed files with 139 additions and 68 deletions

View File

@ -1,6 +1,12 @@
#class(#pointer) Process(Object)
{
#dcl context state prev next.
#dcl initial active state prev next.
#method new
{
"instantiation is not allowed"
^nil. "TODO: raise an exception"
}
#method prev
{
@ -47,6 +53,9 @@
#method add: aProcess
{
<primitive: #_scheduler_add>
self primitiveFailed.
"The primitive does something like the following.
(self.tally = 0)
ifTrue: [
@ -59,13 +68,17 @@
self.head prev: aProcess.
self.head := aProcess.
self.tally := self.tally + 1.
].
]."
}
#method resume: aProcess
{
self add: aProcess.
self.active := aProcess.
<primitive: #_scheduler_add>
self primitiveFailed.
"self add: aProcess.
TODO: need to change state of a Process???
self.active := aProcess."
}
#method remove: aProcess