nlib
|
Sample of nlib_once
. Corresponds to pthread_once
of pthread
.
nlib_once
is used to make initialization code run only once. All threads started in the sample attempt to call OnceFunc
via nlib_once
, but only the first thread actually runs it.
Other threads spin and wait while nlib_onceflag
is running, and run the process nlib_once
after it ends. This guarantees that OnceFunc
is called only once after running nlib_once
.
© 2012-2017 Nintendo Co., Ltd. All rights reserved.