mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-20 05:51:36 +02:00
doc: Update usage.md
This commit is contained in:
11
doc/usage.md
11
doc/usage.md
@@ -54,7 +54,9 @@ Handle to cothread.
|
|||||||
|
|
||||||
Handle must be of type `void*`.
|
Handle must be of type `void*`.
|
||||||
|
|
||||||
A value of `null` (0) indicates an uninitialized or invalid handle, whereas a non-zero value indicates a valid handle.
|
A value of null (0) indicates an uninitialized or invalid handle, whereas a
|
||||||
|
non-zero value indicates a valid handle. A valid handle is backed by execution
|
||||||
|
state to which the execution can be co_switch()ed to.
|
||||||
|
|
||||||
## co_active
|
## co_active
|
||||||
```c
|
```c
|
||||||
@@ -62,7 +64,12 @@ cothread_t co_active();
|
|||||||
```
|
```
|
||||||
Return handle to current cothread.
|
Return handle to current cothread.
|
||||||
|
|
||||||
Always returns a valid handle, even when called from the main program thread.
|
Note that the handle is valid even if the function is called from a non-cothread
|
||||||
|
context. To achieve this, we save the execution state in an internal buffer,
|
||||||
|
instead of using the user-provided memory. Since this handle is valid, it can
|
||||||
|
be used to co_switch to this context from another cothread. In multi-threaded
|
||||||
|
applications, make sure to not switch non-cothread context across CPU cores,
|
||||||
|
to prevent any possible conflicts with the OS scheduler.
|
||||||
|
|
||||||
## co_derive
|
## co_derive
|
||||||
```c
|
```c
|
||||||
|
Reference in New Issue
Block a user