-
Notifications
You must be signed in to change notification settings - Fork 50
Communication API
nelsonje edited this page Jan 14, 2013
·
1 revision
I see three standard uses for messages:
-
Simple remote execution.
{ auto m = scopedMessage( core, [] { fn(); } ); m.block_until_sent(); // optional }
-
Remote execution with variable-sized payload. Payload is copied into message.
{ auto m = scopedPayloadMessage( core, [] ( void * payload, int16_t size ) { fn( payload, size ); } payload, size ); m.block_until_sent(); // optional }
-
Legacy message to interact with existing active messages. Args struct and payload are copied into message.
{ auto m = scopedLegacyMessage( core, function_pointer, args_pointer, payload_pointer, payload_size ); m.block_until_sent(); // optional }
This is equivalent to
{
auto m = scopedPayloadMessage( core,
[]( A* args, void* payload, size_t size) {
function_pointer( args, sizeof(A), payload, payload_size );
},
args_pointer, sizeof(A),
payload_pointer, payload_size
);
m.block_until_sent(); // optional
}