Skip to contentSkip to conversation

blocked or not blocked call on snippet/shared_mem.c?

Xenomai-help Rodrigo Rosenfeld Rosas 2 participants 2 messages Jan 18, 2006

lore
Share & tools
lore
#0 lore raw

I was looking at the xenomai snippets and found the shared_mem.c snippet confused.

Here's a snippet from the snippet ;)

/* ...The call will block us until such heap
is created with the expected name... */

err = rt_heap_bind(&heap_desc,"SomeShmName",TM_NONBLOCK);

I'm confused. Did you really mean TM_NONBLOCK?
Am I missing something?

Thanks in advance,

Rodrigo.

_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

#1 lore raw
Quoted 3 lines

I'm confused. Did you really mean TM_NONBLOCK?
Am I missing something?

I think you have to read it like this:

Bind to a shared heap which has been created elsewhere, either in kernel or user-space. The call will block us until such heap is created with the expected name.

Therefore (because we do not want (and are probably unable to, see
below)), we supply TM_NONBLOCK.

The heap should have been
created with the H_SHARED mode set, which is implicit when creation takes place in user-space.

Additionally, I think the process wouldn't even block if requested because it is not a Xenomai thread. Use rt_task_shadow() to promote it. Make sure you have a suitable bailout mechanism if you happen to start waiting indefinitely.

Jeroen.