Abstract call mechanism with asynchronous support.
More...
#define LWMSG_PARAMS_INITIALIZER |
A constant which may be used to initialize automatic variables of LWMsgParams to sane default values
Tracks a call through its life cycle.
A caller-supplied function which is invoked when an asynchronous call is completed by the callee. A completion function must not block.
- Parameters
-
[in] | call | the call handle |
[in] | status | the status code the call completed with |
[in] | data | a user data pointer |
typedef void(* LWMsgCancelFunction)(LWMsgCall *call, void *data) |
A callee-supplied function which is invoked when an asynchronous operation is cancelled by the caller. A cancellation function must not block.
- Parameters
-
[in] | call | the call handle |
[in] | data | a user data pointer |
Destroys the contents of a parameters structure that was previously filled in by the given call handle. If the parameters structure contains no data (e.g. tag is LWMSG_TAG_INVALID), this function will take no action and return LWMSG_STATUS_SUCCESS. Therefore, you may always safely use this function on a LWMsgParams structure that has been correctly initialized (e.g. with LWMSG_PARAMS_INITIALIZER) to free any data it might contain.
- Parameters
-
[in] | call | the call handle |
[in,out] | params | the parameters structure |
- Return values
-
Dispatches a call. If complete is provided, the callee may opt to complete the call asynchronously, in which case it will be invoked at completion time in an arbitrary thread.
- Parameters
-
[in,out] | call | the call handle |
[in] | input | the input parameters |
[out] | output | the output parameters |
[in] | complete | an optional completion callback |
[in] | data | a user data pointer to be passed to the completion callback |
- Return values
-
Marks the given call as pending asychronous completion. This function must only be used by callees. It signifies the callee's intent to complete the call asynchronously with lwmsg_call_complete(). The callee must also cause LWMSG_STATUS_PENDING to be returned from lwmsg_call_dispatch().
- Parameters
-
[in,out] | call | the call handle |
[in] | cancel | a mandatory call cancellation function |
[in] | data | a data pointer to pass to the cancellation function |
Completes the given call with the provided status code. This function must only be used by callees, and only after marking the call as pending with lwmsg_call_pend().
- Parameters
-
[in,out] | call | the call handle |
[in] | status | the call return status |
Waits for the given pending call to complete and returns the status it completed with.
- Parameters
-
- Returns
- the status the call completed with
Releases the given call handle. This function should be used by the caller after it is finished with the call. A pending call may be released before it completes.
- Parameters
-
[in,out] | call | the call handle |
Returns the LWMsgSession associated with the given call. This function may be used by both callers and callees.
- Parameters
-
- Returns
- the session for the call
Returns whether a call is incoming or outgoing.
- Parameters
-
- Returns
- the call type
void lwmsg_call_set_user_data |
( |
LWMsgCall * |
call, |
|
|
void * |
data |
|
) |
| |
Sets an arbitrary user data pointer on a call handle, which may be used for any purpose.
- Parameters
-
[in,out] | call | the call handle |
[in] | data | the data pointer |
void* lwmsg_call_get_user_data |
( |
LWMsgCall * |
call | ) |
|