Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sendmessage thread priority

1 view
Skip to first unread message

R Levels

unread,
Dec 2, 2009, 8:09:01 AM12/2/09
to
In our application we have 3 threads all with different priority. Thread A
with a high priority, Thread B with normal priority, Thread C with low
priority. During startup thread B has a lot of work to do and will eat all
the time it is given by the sheduler (by design). Thread A is nicely sheduled
at the desired moments sometimes pre-empting thread B as it has a higher
priority. No probkem so far.

But when thread A does a "SendMessage" to thread C it will not return from
this, causing it to be "blocked". I think this is caused because thread C is
never sheduled (because of the busy thread B). Is this hypothesis correct and
will there be no priority inversion when calling sendmessage?

PS I only seek conformation on this hypothesis i know there are multiple
solutions to pick from.


Ginny Caughey

unread,
Dec 2, 2009, 8:29:47 AM12/2/09
to
I think you're on the right track. Messages are only delivered when the
receiving thread is alive, and SendMessage blocks until delivery. Would
PostMessage work for you instead?

--

Ginny Caughey
Device Application Development MVP

"R Levels" <RLe...@discussions.microsoft.com> wrote in message
news:9EBDA776-AF8D-4CBA...@microsoft.com...

R Levels

unread,
Dec 2, 2009, 8:41:01 AM12/2/09
to
"Ginny Caughey" wrote:

> I think you're on the right track. Messages are only delivered when the
> receiving thread is alive, and SendMessage blocks until delivery. Would
> PostMessage work for you instead?
>
> --
>
> Ginny Caughey
> Device Application Development MVP
>
>

Thank you for the quick reply. Postmessage is a solution but can work.
Problem is we send a pointer to the string in the message for post message we
must do some extra allocation/delocation.

Bruce Eitman [eMVP]

unread,
Dec 2, 2009, 12:29:46 PM12/2/09
to
No, I don't think that there will be any priority inversion. For priority
inversion to kick in there needs to be two threads involved that know about
each other. In this case Thread C doesn't know about Thread A. Thread C
isn't holding on to a resource that Thread A needs.

You may want to consider a method that would allow you to pass the string,
instead of the pointer. Or any publish and subscribe systems. This way,
Thread A doesn't need to wait for Thread C.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT Eurotech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

Eurotech Inc.
www.Eurotech.com

"R Levels" <RLe...@discussions.microsoft.com> wrote in message
news:9EBDA776-AF8D-4CBA...@microsoft.com...

0 new messages