home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / motif / 5625 < prev    next >
Encoding:
Text File  |  1992-08-14  |  1.1 KB  |  36 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!ark
  3. From: ark@athena.mit.edu (Andrew Kirmse)
  4. Subject: Main loop for multiple app contexts
  5. Message-ID: <1992Aug14.221823.15607@athena.mit.edu>
  6. Sender: news@athena.mit.edu (News system)
  7. Nntp-Posting-Host: w20-575-31.mit.edu
  8. Organization: Massachusetts Institute of Technology
  9. Date: Fri, 14 Aug 1992 22:18:23 GMT
  10. Lines: 24
  11.  
  12.     I'm looking for an efficient main loop to use in a program that uses
  13. several displays via multiple application contexts.  Currently I poll
  14. continuously for events using something like:
  15.  
  16.   while (1)
  17.     {
  18.       for (i=0; i < num_apps; i++)
  19.         {
  20.           if (XEventsQueued(displays[i], QueuedAfterReading))
  21.             {
  22.               XtAppNextEvent(appcontexts[i], &event);
  23.               XtDispatchEvent(&event);
  24.             }
  25.           else XFlush(displays[i]);
  26.       /* background processing here */
  27.         }
  28.     }
  29.  
  30. but this puts a large load on my machine.  Can I perform a select() call on the
  31. display connection file descriptors?  Or are there other ways?
  32.     Please respond via email.  Thanks!
  33.  
  34. ---Andrew Kirmse
  35.    ark@athena.mit.edu
  36.