[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] Windows thread communication?




What message are you sending between threads? Is it a application-specific
message?

Many Windows messages rely on a return value or pass pointers to data... In
this case you will have to find some other way of doing it because pointers
can't be guaranteed to be valid unless its synchronous. How about a shared
memory region with mutex/semaphore? What is the application that you are
trying to write?


----- Original Message -----
From: "Geoff Saxby" <geoffs@nospam.progsoc.uts.edu.au>
To: "The Programmers' Society" <progsoc@nospam.progsoc.uts.edu.au>
Sent: Thursday, May 25, 2000 6:42 PM
Subject: [ProgSoc] Windows thread communication?


> Hi y'all
>
> I'm trying to get two threads to communicate in Windows <SHUDDER>. I'm
> using PostThreadMessage in one thread and PeekMessage in the other
> thread.  PostThreadMessage fails and GetLastError() returns 1159:
> ERROR_MESSAGE_SYNC_ONLY which MSDN tells me means the message can only
> be used with synchronous operations. What does this mean? I thought
> that PostThreadMessage allowed asynchronous communication between
> threads. Any ideas why this happens? Or how else can I send a message
> from one thread to the other without the first thread blocking?
>
> BTW, I'm using Borland C++ Builder 5 Enterprise. Problem is the same on
> Windows 98 and 2000.
>
> TIA
> Geoff
> --
> ------------------------------------------------------------------------
>    Geoff Saxby   geoffs@nospam.mindless.com
>                  http://www.progsoc.uts.edu.au/~geoffs
>
>    "I don't know where you magic pixies came from, but I sure like your
>    pixie drink!"
>    -- Barney Gumble
> ------------------------------------------------------------------------
> -
> You are subscribed to the progsoc mailing list. To unsubscribe, send a
> message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
> If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.
>

-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.