Spencer Salazarnew testing framework3e7be8b13 years agoHistory
41 lines · 558 B · Text
RawDownload
// 54.ck : creating custom event objects // new event classclass TheEvent extends Event{    int value;} // the eventTheEvent e; // handlerfun int hi( TheEvent e ){    while( true )    {        // wait on event        e => now;        // get the data        <<<e.value>>>;    }} // sporkspork ~ hi( e );spork ~ hi( e );spork ~ hi( e );spork ~ hi( e ); // infinite time loopwhile( true ){    // advance time    1::second => now;     // set data    math.rand2( 0, 5 ) => e.value;     // signal one waiting shred    e.signal();}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t