mirror of https://github.com/bsnes-emu/bsnes.git
doc: Document `co_serializable()`.
This commit is contained in:
parent
4f75515cd3
commit
e7accf7092
|
@ -75,6 +75,11 @@ auto APU::leaf() -> void {
|
|||
}
|
||||
|
||||
auto main() -> int {
|
||||
if(!co_serializable()) {
|
||||
printf("This implementation does not support serialization\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Memory::buffer = (uint8_t*)mmap(
|
||||
(void*)0x10'0000'0000, 2 * 65536,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
|
|
13
doc/usage.md
13
doc/usage.md
|
@ -126,6 +126,19 @@ Passing handle of active cothread to this function is not allowed.
|
|||
|
||||
Passing handle of primary cothread is not allowed.
|
||||
|
||||
## co_serializable
|
||||
|
||||
```c
|
||||
int co_serializable(void);
|
||||
```
|
||||
|
||||
Returns non-zero if the implementation keeps the entire coroutine state in the
|
||||
buffer passed to `co_derive()`. That is, if `co_serializable()` returns
|
||||
non-zero, and if your cothread does not modify the heap or any process-wide
|
||||
state, then you can "snapshot" the cothread's state by taking a copy of the
|
||||
buffer originally passed to `co_derive()`, and "restore" a previous state
|
||||
by copying the snapshot back into the buffer it came from.
|
||||
|
||||
## co_switch
|
||||
```c
|
||||
void co_switch(cothread_t cothread);
|
||||
|
|
Loading…
Reference in New Issue