06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pSOS+ <strong>System</strong> <strong>Calls</strong> q_receive<br />

q_receive Requests a message from an ordinary message queue.<br />

#include <br />

unsigned long q_receive(<br />

unsigned long qid, /* queue identifier */<br />

unsigned long flags, /* queue attributes */<br />

unsigned long timeout, /* timeout in clock ticks */<br />

unsigned long msg_buf[4] /* message buffer */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

This system call enables a task or an ISR to obtain a message from an ordinary<br />

message queue.<br />

qid Specifies the queue ID of the target queue.<br />

flags Specifies whether q_receive() will block waiting for a message.<br />

flags should have one of the following values (defined in<br />

):<br />

Q_NOWAIT Don't wait for message.<br />

Q_WAIT Wait for message.<br />

timeout Specifies the timeout interval, in units of clock ticks.<br />

msg_buf An output parameter. Contains the received message.<br />

If the queue is non-empty, this call always returns the first message there. If the<br />

queue is empty and the caller specified Q_NOWAIT, then q_receive() returns with<br />

an error code. If Q_WAIT is elected, the caller will be blocked until a message is<br />

posted to the queue, or if the timeout argument is used, until the timeout occurs<br />

whichever happens first. If timeout is zero and Q_WAIT is selected, then<br />

q_receive() will wait forever. The timeout argument is ignored if Q_NOWAIT is<br />

selected.<br />

This system call returns 0 on success or an error code on failure.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 1-81<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!