From: Jan Kiszka <jan.kiszka@domain.hid>
To: mani bhatti <imranbashirbhatti@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Problem with rt_queue
Date: Thu, 26 Oct 2006 00:50:15 +0200 [thread overview]
Message-ID: <453FEA27.3020705@domain.hid> (raw)
In-Reply-To: <20061025143438.30247.qmail@domain.hid>
[-- Attachment #1.1: Type: text/plain, Size: 1067 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: native-queue-bcast-fix.patch --]
[-- Type: text/x-patch; name="native-queue-bcast-fix.patch", Size: 926 bytes --]
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 <jan.kiszka@domain.hid>
+
+ * ksrc/skins/native/queue.c (rt_queue_send): Track message count
+ correctly when broadcasting to a queue without listeners.
+
2006-10-25 Jan Kiszka <jan.kiszka@domain.hid>
* ksrc/drivers/testing/irqbench.c, doc/txt/irqbench.txt,
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
next prev parent reply other threads:[~2006-10-25 22:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-16 15:39 [Xenomai-help] Problem with rt_queue mani bhatti
2006-10-16 15:50 ` Jan Kiszka
2006-10-16 15:58 ` Philippe Gerum
2006-10-25 14:34 ` mani bhatti
2006-10-25 22:50 ` Jan Kiszka [this message]
2006-10-27 15:13 ` mani bhatti
2006-10-27 16:52 ` Jan Kiszka
2006-10-30 16:08 ` mani bhatti
2006-10-30 17:37 ` Jan Kiszka
2006-12-06 15:04 ` [Xenomai-help] problem persists " mani bhatti
2006-12-06 15:30 ` [Xenomai-help] " Jan Kiszka
2006-12-06 16:11 ` mani bhatti
2006-12-06 16:44 ` Jan Kiszka
2006-10-27 21:23 ` [Xenomai-help] Problem " Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=453FEA27.3020705@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=imranbashirbhatti@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.