Skip to content

Commit fbb50fe

Browse files
authored
Merge pull request #342 from Patater/update-rpc-doc-for-box-id
Update description of rpc_fncall_waitfor()
2 parents 3b521dc + 1c36c8d commit fbb50fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/api/manual/UseCases.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,13 @@ An RPC needs some context in which to execute. The context in which an RPC runs
583583
Let's have a look at this function.
584584

585585
```C++
586-
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
586+
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, int * box_id_caller, uint32_t timeout_ms);
587587
```
588588
589589
There are not so many parameters.
590590
* `fn_ptr_array` - an array of RPC function targets that this call to `rpc_fncall_waitfor` should handle RPC to
591591
* `fn_count` - the number of function targets in this array
592+
* `box_id_caller` - a memory location to store the box ID of the calling box (the source box of the RPC). This is set before the RPC is dispatched, so that the RPC target function can read from this location to determine the calling box ID. Optional.
592593
* `timeout_ms` - specifies how long to wait (in ms) for an incoming RPC calls before returning
593594
594595
And finally, the return value specifies the status of the wait (whether it timed out, or if the pool is too small, or if an RPC was handled).
@@ -606,8 +607,9 @@ static void unicorn_barf_rpc_thread(const void *)
606607
while (1) {
607608
int status;
608609
static const uint32_t timeout_ms = UVISOR_WAIT_FOREVER;
610+
static const int * box_id_caller = NULL;
609611
610-
status = rpc_fncall_waitfor(my_fn_array, ARRAY_COUNT(my_fn_array), timeout_ms);
612+
status = rpc_fncall_waitfor(my_fn_array, ARRAY_COUNT(my_fn_array), box_id_caller, timeout_ms);
611613
if (!status) {
612614
/* ... Handle unsuccessful status ... */
613615
}

0 commit comments

Comments
 (0)