Lasso Soft Inc. > Home

[ capture->splitthread ]


A new thread can be created by calling the capture->splitthread() method. 

The capture given to capture->splitthread() will be run in a new thread. This new thread will contain copies of the local variables that are active at the time the new thread is created. Changing the value of a variable in the new thread will not effect the variables that were active at the creation point. Additionally, the current self is cleared for the new thread.

When a new thread is created by calling { }->splitthread(), the return value of that method call is a pair of filedesc objects. Similarly, the parameter given to the new thread is a pair of filedesc objects. A filedesc object represents a file or pipe over which data can be sent or received. These filedesc objects provide a means for the new thread and the creator thread to communicate. Two filedesc objects are required for thread communication, one representing the write end of the pipe and the other representing the read end. Objects are written to the write filedesc and read from the read filedesc.

  • Syntax
{ }->splitThread => { }
  • Advanced

Create a new thread


{}->splitThread =>  { stdoutnl(`I'm alive in a new thread: ` + #example) }


(filedesc = filedesc)

// In console
I'm alive in a new thread: 123

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft