20,741
edits
(→August 14: https://gitorious.org/~philosopher/fg/philosophers-simgear/commit/059441b49274bb87c1a279a2111e829e22ab9b5b#comment_99102) |
|||
| Line 67: | Line 67: | ||
return temp; | return temp; | ||
} | } | ||
synced. | synced.atomic_do = func (what, thread_id=nil) { | ||
var start = systime(); | var start = systime(); | ||
thread.lock( me._LOCK); | thread.lock( me._LOCK); | ||
| Line 81: | Line 81: | ||
thread.newthread = func(code, thread_id) { | thread.newthread = func(code, thread_id) { | ||
counter. | counter.atomic_do ( func counter.get() +=1 ); # increment thread counter | ||
code(); # run callback in new thread | code(); # run callback in new thread | ||
counter. | counter.atomic_do ( func counter.get() -=1 ); # decrement thread counter | ||
} | } | ||