home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.os2.programmer
- Path: sparky!uunet!spool.mu.edu!wupost!cs.utexas.edu!torn!watserv2.uwaterloo.ca!csg.uwaterloo.ca!giguere
- From: giguere@csg.uwaterloo.ca (Eric Giguere)
- Subject: Re: Dialogs + Threads = Problems. Help!
- Message-ID: <C0D4rH.1rK@watserv2.uwaterloo.ca>
- Sender: news@watserv2.uwaterloo.ca
- Organization: Computer Systems Group, University of Waterloo
- References: <92366.110046U37127@uicvm.uic.edu> <1993Jan3.054918.1861@netcom.com> <1993Jan4.205811.107@actrix.gen.nz>
- Date: Tue, 5 Jan 1993 04:06:52 GMT
- Lines: 26
-
- In article <1993Jan4.205811.107@actrix.gen.nz> Dennis.Ingram@bbs.actrix.gen.nz writes:
- >As I understand it, in order for a thread to use WinSendMsg it must
- >have a message queue. I have always wondered what is the best thing
- >to do when you have multiple threads that need to access a window - do
- >you use WinPostMsg and block using semaphores, or define a queue and
- >use WinSendMsg? What is the overhead of defining a message queue (in
- >terms of system resources), bearing in mind that the queue is only
- >there to allow WinSendMsg access?
-
- Well, it depends. If the calling threads are yours -- you created them --
- then I think creating a message queue is the simplest thing to do. Don't
- forget that you can limit the size of the queue to something small if
- you're not going to be creating any windows. Why not let PM do all the
- synchronization work for you?
-
- The WinPostMsg/semaphore method must be used if you're being called by
- a thread that you didn't create, because then you can't reliably create
- a message queue. The PM docs state that creating a message queue should
- only be done at most once per thread, and I have not found any way to
- check for the existance of a message queue (if anyone knows, please tell me!).
- This method definitely takes more work because you have to allocate
- the semaphore and pass it to the other thread...
-
- --
- Eric Giguere giguere@csg.UWaterloo.CA
- So is Windows NT short for "Windows, NOT?"
-