sco_api.unsubscribe
Any thread. Applies at once: a running dispatch won’t call fn again. Freeing ctx: on the game thread, right after unsubscribe returns (also from inside fn itself). From another thread fn may be running now; call run_on_game_thread after unsubscribe returns and free ctx in that task. Tasks never run while a dispatch is in progress.
Signature
Section titled “Signature”sco_result (*)(sco_plugin *, const char *, sco_event_fn)Service and availability
Section titled “Service and availability”| Property | Value |
|---|---|
| Symbol | sco_api.unsubscribe |
| Record ID | sco-api-unsubscribe |
| Service | sco_api |
| Table | sco_api |
| Version macro | SCO_API_MAJOR/SCO_API_MINOR |
| Packed table version | 65537 |
| Since / availability | size >= 48; 1.0 |
| Complete member extent (x64 bytes) | 48 |
| Table size (x64 bytes) | 128 |
Parameters and buffers
Section titled “Parameters and buffers”sco_result (*unsubscribe)(sco_plugin* self, const char* event, sco_event_fn fn);
Any thread. Applies at once: a running dispatch won’t call fn again. Freeing ctx: on the game thread, right after unsubscribe returns (also from inside fn itself). From another thread fn may be running now; call run_on_game_thread after unsubscribe returns and free ctx in that task. Tasks never run while a dispatch is in progress.
Results and failures
Section titled “Results and failures”BAD_ARG invalid/released self or NULL event/fn; NOT_FOUND no matching subscription; TOO_MANY replacement-list allocation failure. No capability gate.
Absent capability
Section titled “Absent capability”unspecified
Ownership
Section titled “Ownership”Caller owns fn/ctx. Host may allocate replacement subscription list. Follow callback-quiescence rule before freeing ctx.
Thread affinity
Section titled “Thread affinity”Any thread; allowed inside own event callback. Does not join off-thread in-flight callback; other reentrancy unspecified.
Callback context
Section titled “Callback context”unspecified
Reentrancy
Section titled “Reentrancy”allowed inside own event callback.
Cleanup and cancellation
Section titled “Cleanup and cancellation”On successful removal no new callback, including remainder of current dispatch; off-thread already-running callback may finish. Free ctx via later game-thread task.
Language mappings
Section titled “Language mappings”Status labels are copied verbatim from the catalogue: direct is native access; typed-wrapper is wrapper-backed; restricted is a subset/adaptation; unsupported means no supported route is established. No status implies universal safety.
| Language | Catalogue status | Source evidence / wrapper tokens |
|---|---|---|
| c | direct | include/sco_api.h(*unsubscribe) |
| cpp | typed-wrapper | include/scosdk/plugin.hpps->api->unsubscribe(s->self, it->first.c_str(), detail::EventTrampoline); |
| csharp | typed-wrapper | sdk/csharp/Sco.Sdk/Plugin.csfixed (byte* n = Utf8.Z(slot.Event)) _api->unsubscribe(_self, n, EventFn); |
| lua | typed-wrapper | plugins/lua/sco_lua.cs->api->unsubscribe(s->self, e->name, sco_lua_event_); |
Examples
Section titled “Examples”- tests/abi_v1.c
- tests/test_app.cpp
- tests/test_datacore_service.cpp
- tests/test_host.cpp
- tests/test_ipc.cpp
- tests/test_lua.cpp
- tests/test_net_service.cpp
- tests/test_plugins.cpp
- tests/test_sdk.cpp
- tests/test_settings.cpp
- tests/test_storage.cpp
- tests/test_ui.cpp
- sdk/csharp/Sco.Sdk.Tests/FakeHost.cs
- tools/test.sh
- sdk/csharp/Sco.Sdk.Tests/Layout.cs
ABI pins prove layout, not semantic behavior or a live game session.