home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3906 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!alf.uib.no!hsr.no!fics!matt
  3. From: matt@fics.uucp (Shithead II)
  4. Subject: Re: Help! Output going everywhere...
  5. Organization: Kvam data as
  6. Date: Sat, 25 Jul 1992 05:00:58 GMT
  7. Message-ID: <1992Jul25.050058.1411@fics.uucp>
  8. Keywords: pipes, widgets, children
  9. References: <1992Jul24.040517.3375@tc.cornell.edu>
  10. Lines: 35
  11.  
  12. In article <1992Jul24.040517.3375@tc.cornell.edu> reed@theory.tc.cornell.edu writes:
  13. >I have a X client (motif widget set being used) that spawns a number of
  14. >childen.  Now, since I use fork(), all file descripters are copied over to
  15. >the children.  This is fine and dandy, but what I really want is to capture
  16. >the output (stderr & stdout) from the children in a text widget (motif) in 
  17.  
  18. >if I am hung up in an XtMainLoop call (or do I need to change to something
  19. >else [gasp! handle my own events????])?  I thought of using a SIGIO signal
  20. >handler, but have been unable to get this to work (then again, it's my first
  21.  
  22. I *think* the clue is to lose your XtMainLoop() (i.e. don't use it)
  23. and use something like...
  24.  
  25.    if (XtAppPending(ac))
  26.    {
  27.       XtAppNextEvent(ac, &event);
  28.       XtDispatchEvent(&event);
  29.    }
  30.    else
  31.    {
  32.       /* do the read_from_pipe_thing() */
  33.    }
  34.  
  35. The XtAppNextEvent() blocks waiting for input so I think you want
  36. the XtAppPending() check...This doesn't really have to been an if/else
  37. ...but whatever...
  38.  
  39. oh...and I think the signals are a no-no (I don't believe they were
  40. designed or intended for interprocess communication...)
  41.  
  42. Matthew Kerr
  43. Kvam data as
  44. Nikkelveien 14, N-4300 Sandnes, Norway
  45. Tel: + 47 4 62 37 66
  46. Fax: + 47 4 62 39 85
  47.