I have the following code:
newProc := [self doSth] newProcess.
newProc resume.
self doOtherJob.
newProc wait. "<- here is the question"
In the last line I would like to wait for the process, till it is ready with the work. Unfortunately there is no method 'wait' in Process. Do I have to write my own wait routine or is there arleady something, that I didn't find yet?
Originally by Camillo Bruni:
Semaphores are your friends:
semaphore := Semaphore new.
[ ... First Job ...
semaphore signal. ] fork.
[ ... Second Job ...
semaphore signal. ] fork.
"consume to signals, aka. pause this thread until both jobs have finished"
semaphore wait; wait.
In your case you have to do:
semaphore := Semaphore new.
newProc := [
self doSth.
semaphore signal ] newProcess.
newProc resume.
self doOtherJob.
semaphore wait.