tk_snd_mbf

Send Message to Message Buffer

[C Language Interface]

ER ercd = tk_snd_mbf ( ID mbfid, VP msg, INT msgsz, TMO tmout ) ;

[Parameters]

ID mbfid Message buffer ID

INT msgsz Send message size (in bytes)

VP msg Start address of send message packet

TMO tmout timeout

[Return Parameters]

ER ercd Error code

[Error Codes]

E_OK Normal completion

E_ID Invalid ID number (mbfid is invalid or cannot be used)

E_NOEXS Object does not exist (the message buffer specified in mbfid does not exist)

E_PAR Parameter error (msgsz < 0, msgsz > maxmsz,value that cannot be used in msg, or tmout < (-2))

E_DLT The object being waited for was deleted (message buffer was deleted while waiting)

E_RLWAI Wait state released (tk_rel_wai received in wait state)

E_DISWAI Wait released by wait disabled state

E_TMOUT Polling failed or timeout

E_CTX Context error (issued from task-independent portion or in dispatch disabled state)

[Description]

Sends the message at the address specified in msg to the message buffer specified in mbfid. The message size is indicated in msgsz. This system call copies msgsz bytes starting from msg to the message queue of message buffer mbfid. The message queue is implemented as a ring buffer.

If msgsz is larger than the maxmsz specified with tk_cre_mbf, error code E_PAR is returned.

If there is not enough available buffer space to accommodate message msg in the message queue, the task issuing this system call goes to send wait state and is queued waiting for buffer space to become available (send queue). Waiting tasks are queued in either FIFO or priority order, depending on the attribute made with tk_cre_mbf.

A maximum wait time (timeout) can be set in tmout. If the tmout time elapses before the wait release condition is met (before there is su.cient buffer space), the system call terminates, returning timeout error code E_TMOUT.

Only positive values can be set in tmout. The time base for tmout (time unit) is the same as that for system time (= 1 ms).

When TMO_POL = 0 is set in tmout, this means 0 was specified as the timeout value, and E_TMOUT is returned without entering WAIT state if there is not enough buffer space.

When TMO_FEVR =(-1) is set in tmout, this means in.nity was specified as the timeout value, and the task continues to wait for buffer space to become available, without timing out. A message of size 0 cannot be sent. When msgsz < 0 is specified, error code E_PAR is returned.

When this system call is invoked from a task-independent portion or in dispatch disabled state, error code E_CTX is returned; but in the case of tmout = TMO_POL, there may be implementations where execution from a task-independent portion or in dispatch disabled state is possible.

Comments