home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / softsys / andrew / 1387 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!ucbvax!rchland.ibm.com!tinglett+
  2. From: tinglett+@rchland.ibm.com (Todd Inglett)
  3. Newsgroups: comp.soft-sys.andrew
  4. Subject: Re: message queue with ATK
  5. Message-ID: <gf2ZSdw91Jbd17dlp5@rchland.ibm.com>
  6. Date: 18 Nov 92 14:48:09 GMT
  7. References: <1992Nov17.234622.5623@adobe.com>
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Reply-To: "Todd Inglett" <tinglett@vnet.ibm.com>
  10. Distribution: world
  11. Organization: The Internet
  12. Lines: 39
  13.  
  14. Excerpts from ext.misc.info-andrew: 17-Nov-92 Re: messagequeue with ATK
  15. Zalman Stern@decwrl.dec. (1573)
  16.  
  17. > The namespace for System V message queues is disjoint from the file
  18. > descriptor namespace. They do not work with select and hence donot fit into
  19. ATK interaction model.
  20.  
  21. This may be true in general, but be sure to look closely at the
  22. selectcall on your system.  In AIX, for example, the first argument to
  23. selectindicates how many file descriptors and message queues are
  24. specified in theother arguments.  The lower 16 bits of the first
  25. argument specify the # offiles and the upper 16 bits specify the # of
  26. message queues.  Because it wouldbe impossible to specify 64535 file
  27. descriptors (AIX has a limit of around2000 or so), it is completely
  28. compatible with the `old' select.
  29.  
  30. Still, this means that you must modify ATK at a very low level. 
  31. Inparticular, you must add at least two new class procedures
  32. toatk/basics/common/im.ch and their implementations in im.c:
  33.  
  34.     AddMsgQHandler(int msgqid, procedure proc, char *procdata,
  35.     longpriority) returns boolean;
  36.     RemoveMsgQHandler(int msgqid);
  37.  
  38. You will have to add an array of MsgQHandlers to the struct
  39. im_GlobalDataType(scroll down in im.ch), and write the two new class
  40. procedures to add/removethe handlers from this MsgQHandlers list. 
  41. Finally, you must modifyxim__HandleFiles in atk/basics/x/xim.c so that
  42. the select system callis given the appropriate arguments.  This code is
  43. a little tricky, but with alittle persistence I am sure you can get it
  44. to work.
  45.  
  46. Now your ADEW application can call im_AddMsgQHandler to setup acallback
  47. whenever input arrives from the queue.  But remember, this will onlywork
  48. if your select supports both queues and file descriptors.  Ifyour select
  49. doesn't support message queues, how about the poll systemcall (if you
  50. have one)?  It could be used in place of select.
  51.  
  52. -todd inglett
  53.