RTEMS Q returns RTEMS_SUCCESSFUL but with length of message zero

John Bebbington bebbington.john at litef.de
Fri May 10 10:41:40 UTC 2002


Hi,

I have been using RTEMS for some time now with very good results.
Unfortunately I still have an unexplained event which I currently have a
work-around for in the application but would like to ask if perhaps the
behaviour is correct or not.

When using rtems_message_queue_receive(..) with no blocking (polling) I get
a return code RTEMS_SUCCESSFUL but when I check the length of the message it
is zero!

The example below shows the call and the additional plaus test I am doing as
a work-around.


Additional Information:
========================

o The system is being interrupted by about 5 levels of interrupt handlers
which all are attached to RTEMS via the
  rtems_interrupt_catch directive.
o When The CPU duty is approx 12% the error does not occur, but with
additional transmits and a duty of 49% the
  errors start occurring.


The question is, is the call to rtems_message_queue_receive() "managed" to
the extend that the RTEMS_SUCESSFUL can only be returned when there is a
message available.



-----start of code snippit ---------------

	rtems_status_code 	status	;
	unsigned32		 	size 	= 	0;
	bool				newmsg;

	// Check for new messages on the input Q but do not WAIT!!!
	status = (
			QueueID[q_BIT_HISTORY_Q],
			rec,
			&size,
			RTEMS_NO_WAIT,
			0
			);

	switch (status){
		case RTEMS_SUCCESSFUL:
			newmsg = true;
			break;
		case RTEMS_UNSATISFIED:
			newmsg = false;
			break;
		default:
			newmsg = false;
			ON_RTEMS_ERROR_LOG2( status, E_RTEMS_Q_READ, 0x0001 );
			break;
	};


	if ( newmsg && (size == 0) ){

	 	// Extra check for plausibility.
		// =============================
		// We sometimes get a message with length = 0
		// but with status RTEMS_SUCCESSFUL, this is not logical.
		// In this case we shall ignore the zeroed message and log the error.

		newmsg = false;
 		LOG2( E_RTEMS_Q_RETURNS_OK_BUT_LEN_ZERO,0x0001);
	}

-----end of code snippit ---------------




John Bebbington
Freelance Software Engineer
Black Forest
Germany
web-site : www.rtss.de







More information about the users mailing list