# HG changeset patch # User Paul Boddie # Date 1647368513 -3600 # Node ID 0002b297ad59e4d52782a065168179556dd94aa3 # Parent 44505f35cf2c1fe596f8f387ea061354fbaca705 Updated libipc function usage. diff -r 44505f35cf2c -r 0002b297ad59 docs/wiki/Servers --- a/docs/wiki/Servers Mon Mar 14 01:34:59 2022 +0100 +++ b/docs/wiki/Servers Tue Mar 15 19:21:53 2022 +0100 @@ -225,42 +225,36 @@ component can be exposed to other programs as follows: {{{ -ipc_server_bind("server", (l4_umword_t) &obj, &server); +ipc_server_loop_for(Calc, &obj, "server"); }}} -Here, the `server` variable is of type `l4_cap_idx_t` (indicating a -capability). The named capability is obtained and assigned to the variable, -with the object itself presented to label incoming messages, indicating which -IPC gate was involved in delivering the message. - -The details of waiting for messages, testing the label, and directing requests -to the component are dealt with by another convenience function (or macro, -more accurately): - -{{{ -ipc_server_loop_for(Calc, &obj); -}}} - -Here, the following parameters are specified: +This convenience function (or, more accurately, macro) binds the main thread +to the named capability. This also handles the details of waiting for messages +and directing requests to the component, with the following parameters being +specified: * The interface type involved - * The object address which is used to check message labels + * The object address for the component + + * The named capability through which incoming messages will be received === Technical Details === -This macro invocation expands to a call to `ipc_server_loop` with the +This macro invocation expands to a call to `_ipc_server_loop_for` with the following parameters: * The predefined number of items expected for the `Calc` interface, generated automatically and provided by `Calc_expected_items` - * The object address which is used to check message labels + * The object address for the component * A handler function for directing requests to the component, this being provided by the generated `handle_Calc` function which must be cast to an acceptable type as indicated + * The named capability through which incoming messages will be received + Here, the macro casts the object address to the appropriate type. In simple cases, this is a superfluous operation since the object type will be directly compatible with the interface type used to expose the object, and such a