[Program] new: [Block]. | Manual

[Program] new: [Block].

Forks the program into two programs. Creates another program that will run at the same time as the current program. Both the parent and the child will obtain a reference to the newly created program. The child will obtain a reference to itself passed as a parameter to the code block while the parent will obtain its version of the program instance as the return value of the new: message. Note that spawning a new program will leak memory. The file descriptors used to setup communication between parent and child will be removed when the main program ends but any newly created program will add a descriptor pair to the set. This is a limitation in the current implementation.
Usage:


 child := Program new: { :program
 	Pen write: 'Child', brk.
 }.
 Pen write: 'Parent'.

back to homepage
back to manual menu

This API reference guide has been generated automatically from source code comments using the shtml.ctr script.