Thanks a lot Jan for the reply.Now after changing the task name queue is working but
following message is displayed by the sender if there is no queue which you had pointed in the last email.
rt_queue_alloc(queue_inout, 8) failed
Segmentation fault
Segmentation fault
Actually i dont understand about the patch which you had sent in your last email (because patch seems to be incomple to me ) because that seems to be part of xenomai source code and if that is how can i use that source code in my program for solving my problem i mean at which place in my program should i put that patch .Sorry for your inconvenience.thanks.
Jan Kiszka <[EMAIL PROTECTED]> wrote:
mani bhatti wrote:
> Hi Phillipe and Jan
> Thanks a lot for your help.I am sending the compilable
> source code so that you have an idea what wrong am i
> doing.I am sending the listeners which are listening
> to the same queue at the same time.But i dont know why
> at one time only one listener receives data from
> sender queue inspite of that i am using broadcast
> mode.Thanks a lot.I have attached files for sender and
> listener.
Well, interesting test case. It actually revealed bugs, but not where
expected.
Your problem is a simple bug in the listener tests. They both register a
task of the name "beta", only the first one succeeds (your code is a bit
hackish in this regard - when hunting problems, make sure to check ALL
return codes for potential problems!). Once fixed, your code runs fine here.
Nevertheless, queue_sender by itself uncovered a problem of
rt_queue_send in broadcast mode when no one is listening. The message
reference count got messed up and the queue ran out of memory. The
attached patch fixes it:
Jan
Index: ksrc/skins/native/queue.c
===================================================================
--- ksrc/skins/native/queue.c (Revision 1747)
+++ ksrc/skins/native/queue.c (Arbeitskopie)
@@ -631,7 +631,9 @@ int rt_queue_send(RT_QUEUE *q, void *mbu
prependq(&q->pendq, &msg->link);
else
appendq(&q->pendq, &msg->link);
- }
+ } else
+ /* Ownership did not change, so update reference count. */
+ msg->refcount++;
err = nrecv;
Index: ChangeLog
===================================================================
--- ChangeLog (Revision 1748)
+++ ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2006-10-26 Jan Kiszka <[EMAIL PROTECTED]>
+
+ * ksrc/skins/native/queue.c (rt_queue_send): Track message count
+ correctly when broadcasting to a queue without listeners.
+
2006-10-25 Jan Kiszka <[EMAIL PROTECTED]>
* ksrc/drivers/testing/irqbench.c, doc/txt/irqbench.txt,
All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
_______________________________________________ Xenomai-help mailing list [email protected] https://mail.gna.org/listinfo/xenomai-help
