home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / programm / 7317 < prev    next >
Encoding:
Text File  |  1993-01-05  |  2.0 KB  |  38 lines

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