Skip to content

Commit

Permalink
Fix docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lPrimemaster committed Jan 16, 2025
1 parent aabee50 commit 198c1ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ external API. E.g.:
// Not thread-safe nor keeping the data lifetime
// Just here to illustrate
void* data = 0;
int data_len = 0;
void my_func(/* api specific args, e.g. */void* api_data, int api_data_len, void* userdata)
{
Expand All @@ -164,6 +165,7 @@ void my_func(/* api specific args, e.g. */void* api_data, int api_data_len, void
// save the data somewhere and access it on the onExternalAPITrigger
// method
data = api_data;
data_len = api_data_len;
// deferExec is thread-safe
bck->deferExec(&MyBackend::onExternalAPITrigger);
}
Expand All @@ -183,7 +185,7 @@ public:
// Access data somehow ... Do some work ...
// Or, e.g., dispatch an event
dispatchEvent("externalAPI_data", data);
dispatchEvent("externalAPI_data", data, data_len);
}
};
Expand Down

0 comments on commit 198c1ca

Please sign in to comment.