Successful rtems_region_get_segment() returning NULL pointer ?

Rolf Schroedter Rolf.Schroedter at
Fri Sep 17 11:12:25 UTC 2004

Under which circumstances rtems_region_get_segment() returns a 
RTEMS_SUCCESSFUL status together with a NULL pointer ?

My application has a writer task, obtaining segments of a large region
and sending (adr,size) pairs to a message queue.
A reader task reads the message queue, consumes the data and returns the
region segments.
I see two problems when the reader is slower than the writer and the
region fills up:
1. Sometimes the call to rtems_region_return_segment() never returns,
    thus stalling the reader task.
2. Sometimes the writer call to rtems_region_get_segment() returns
    a NULL pointer, with RTEMS_SUCCESSFUL status. (This seems to happen
    only if the segment is filled up).

Unfortunately I'm not able to reproduce the problem with a simple
application. IMHO understanding 2. could be the key to understand 1.

The call to rtems_region_get_segment() is:

for(;;) {
     if (stat == RTEMS_SUCCESSFUL) break;
if(waited) printf("tm_write: Got segment after waiting: ptr=%p\n", ptr);

Any ideas are welcome.
Thanks & regards,

Rolf Schroedter
German Aerospace Center
Institute of Planetary Research
D-12489 Berlin, Rutherfordstrasse 2
Tel/Fax:  (+49) (30) 67055-416/384
Email:    Rolf.Schroedter at

More information about the users mailing list