mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-18 18:11:29 +02:00
doc: Document co_serializable()
.
This commit is contained in:
@@ -75,6 +75,11 @@ auto APU::leaf() -> void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
|
if(!co_serializable()) {
|
||||||
|
printf("This implementation does not support serialization\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
Memory::buffer = (uint8_t*)mmap(
|
Memory::buffer = (uint8_t*)mmap(
|
||||||
(void*)0x10'0000'0000, 2 * 65536,
|
(void*)0x10'0000'0000, 2 * 65536,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
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.
|
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
|
## co_switch
|
||||||
```c
|
```c
|
||||||
void co_switch(cothread_t cothread);
|
void co_switch(cothread_t cothread);
|
||||||
|
Reference in New Issue
Block a user