The SpreadRPC loop

The SpreadRPC loop — How to create the SpreaDRPC loop for applications

Synopsis

enum                SPRpcStatus;
SPRpcStatus         sp_rpc_run                          (SPRpc *rpc);
gboolean            sp_rpc_is_running                   (SPRpc *rpc);
void                sp_rpc_quit                         (SPRpc *rpc);
SPRpcStatus         sp_rpc_iteration                    (SPRpc *rpc,
                                                         gboolean may_block);
SPRpcStatus         sp_rpc_event_pending                (SPRpc *rpc,
                                                         gboolean *pending);

Description

How to create the SpreaDRPC loop for applications

Details

enum SPRpcStatus

typedef enum
{
  SP_RPC_STATUS_DONE = 0,
  SP_RPC_STATUS_ILLEGAL_SESSION,
  SP_RPC_STATUS_ILLEGAL_MESSAGE,
  SP_RPC_STATUS_CONNECTION_CLOSED,
  SP_RPC_STATUS_UNKNOWN_ERROR
} SPRpcStatus;

SP_RPC_STATUS_DONE

Normal status, every goes right

SP_RPC_STATUS_ILLEGAL_SESSION

Maybe mailbox is not connect to the Spread Ring

SP_RPC_STATUS_ILLEGAL_MESSAGE

Received a illegal message

SP_RPC_STATUS_CONNECTION_CLOSED

The connection is closed

SP_RPC_STATUS_UNKNOWN_ERROR

Unkown error

sp_rpc_run ()

SPRpcStatus         sp_rpc_run                          (SPRpc *rpc);

Execs the SPRpc loop for the messages. It will concluded by a sp_rpc_quit.

rpc :

a SPRpc

Returns :

a status

sp_rpc_is_running ()

gboolean            sp_rpc_is_running                   (SPRpc *rpc);

Returns TRUE isthe SPRpc loop is running.

rpc :

a SPRpc

Returns :

TRUE/FALSE

sp_rpc_quit ()

void                sp_rpc_quit                         (SPRpc *rpc);

Quits from the SPRpc loop.

rpc :

a SPRpc

sp_rpc_iteration ()

SPRpcStatus         sp_rpc_iteration                    (SPRpc *rpc,
                                                         gboolean may_block);

Runs a single iteration for the given SPRpc.

rpc :

a SPRpc

may_block :

whether the call may block

Returns :

a status of the operation

sp_rpc_event_pending ()

SPRpcStatus         sp_rpc_event_pending                (SPRpc *rpc,
                                                         gboolean *pending);

Returns if there some events pending

rpc :

a SPRpc

pending :

location for a boolean

Returns :

the status