theLink 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard - theLib
c - tcl - atl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
MqContextC_TypeApi_C_API

MqContextC - various types used by libmqmsgqueMore...

+ Collaboration diagram for MqContextC_TypeApi_C_API:

Data Structures

struct  MqCallbackS
 used for callback function pointer management More...
 
struct  MqLinkSetupS
 MqContextC - used to create or delete a instance to manage a linkMore...
 

Typedefs

typedef enum MkErrorE(* MqCreateF) (MK_RT mkrt, MQ_CTX const ctx, MK_BFL const args)
 the prototype for the ContextCreate function …
 
typedef void(* MqDeleteF) (MQ_CTX const ctx)
 the prototype for a ContextDelete function …
 
typedef void(* MqHelpF) (MK_STRN basename)
 application specific help function type …
 
typedef int(* MqExitF) (MK_RT mkrt, int num)
 prototype for exit a process or thread …
 
typedef bool(* MqWaitForPipeF) (MK_RT mkrt, MQ_CTX const ctx, const struct MkIdS *idP)
 Wait for a pipe-server to finish …
 
typedef void(* MqSetupF) (MQ_CTX const ctx)
 used to setup (initialize) a new thread/fork/process created by libmqmsgque using the SysServer? style commands
 
typedef void(* MqRefCountF) (MK_RT mkrt, MQ_CTX ctx, MK_PTR const env)
 used in MqTypeCtxS::fIncrSelf and MqTypeCtxS::fDecrSelf to protect an "embedded" self on deletion
 

Detailed Description

MqContextC - various types used by libmqmsgque

Typedef Documentation

◆ MqCreateF

typedef enum MkErrorE( * MqCreateF) (MK_RT mkrt, MQ_CTX const ctx, MK_BFL const args)

the prototype for the ContextCreate function …

This function is the MqContextS::fCreate and MqContextS::fThreadCreate parameter and is used to :

  1. create a child context
  2. create a parent context as the thread entry point
Parameters
[in]mkrtthe runtime environment
[in]ctxcontext configuration (NULL is not allowed)
args[in,out] this is the args buffer-list pointer

Definition at line 975 of file LibMqMsgque_mq.h.

◆ MqDeleteF

typedef void( * MqDeleteF) (MQ_CTX const ctx)

the prototype for a ContextDelete function …

This function is the MqContextS::fDelete and MqContextS::fThreadDelete parameter and is used to:

  1. delete a child context
  2. delete a parent context at the thread exit point

Definition at line 1204 of file LibMqMsgque_mq.h.

◆ MqExitF

typedef int( * MqExitF) (MK_RT mkrt, int num)

prototype for exit a process or thread …

By default, a process-MqExitF never returns, but this is not true for a thread-MqExitF, where a "return" from the thread-worker-process terminates the thread.

If the exit is not coverd in the MqExitF function than a false-return signal that a further processing with MkSysExit should be done.

Returns
num - the return code.

Definition at line 1230 of file LibMqMsgque_mq.h.

◆ MqHelpF

typedef void( * MqHelpF) (MK_STRN basename)

application specific help function type …

Parameters
basenamethe basename of the tool

Definition at line 1212 of file LibMqMsgque_mq.h.

◆ MqRefCountF

typedef void( * MqRefCountF) (MK_RT mkrt,MQ_CTX ctx, MK_PTR const env)

used in MqTypeCtxS::fIncrSelf and MqTypeCtxS::fDecrSelf to protect an "embedded" self on deletion

"Embedding" libmqmsgque into an other language create TWO views on the same ctx … an other-language-view and an c-api-view. The MqContextS::obj->self is the connection c-api -> other-lng and the other-lng has something equal. Usually the other-lng using MqContextS->MkObjectS::refCount++ and MqContextS->MkObjectS::refCount– to bind the c-api-view to the other-language-view. For the special purpose of "embedding" a slave into a master*… as example… the *slave is entirely controlled by the master and the MqContextS::obj->self have to be protected*… this protection is done with *other-lng-refCount-protection

Definition at line 1275 of file LibMqMsgque_mq.h.

◆ MqSetupF

typedef void( * MqSetupF) (MQ_CTX const ctx)

used to setup (initialize) a new thread/fork/process created by libmqmsgque using the SysServer? style commands

Definition at line 1261 of file LibMqMsgque_mq.h.

◆ MqWaitForPipeF

typedef bool( * MqWaitForPipeF) (MK_RT mkrt, MQ_CTX const ctx, const struct MkIdS *idP)

Wait for a pipe-server to finish …

This function is used internally to synchronize the commands in a @ pipe. To overload this function with a new functionality, use MqTypeCtxS::MqWaitForPipeCB.

param_mkrt param_ctx param[in] idP Filled by process/thread startup function return boolean to indicate if wait was done (MK_YES) or not (MK_NO)

Example: default implementation
static void sIoWaitForPipe (
MQ_CTX const context,
const struct MkIdS * idP
) {
errno = 0;
//mk_dbg_color_ln(MK_COLOR_BLUE,"mkrt=%p, ctx=%p, idP=%p", MK_RT_PTR, context, idP);
// #1 call "overload" is available
if (MqContextCT_X(context)->MqWaitForPipeCB &&
(*MqContextCT_X(context)->MqWaitForPipeCB)(MK_RT_CALL context, idP) ) return;
// #2 is "wait" was NOT done use the default
switch (idP->type) {
case MK_ID_PROCESS: {
MkSysWaitForProcess(MK_ERROR_IGNORE, idP->val);
break;
}
case MK_ID_THREAD: {
MkSysWaitForThread(MK_ERROR_IGNORE, idP->val);
break;
}
case MK_ID_UNUSED: {
break;
}
}
}

Definition at line 1250 of file LibMqMsgque_mq.h.