Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!cathedral!vrm From: vrm@cathedral.cerc.wvu.wvnet.edu (Vasile R. Montan) Newsgroups: comp.windows.x Subject: Need Help with mixing RPC and X Keywords: RPC,Events Message-ID: <547@cerc.wvu.wvnet.edu.edu> Date: 30 May 90 21:13:36 GMT Sender: news@cerc.wvu.wvnet.edu Lines: 47 I have only been working with X for a short time so this may be a basic question or even a stupid one, but I would appreciate any help that I can get. I am trying to convert an RPC server and client from handling standard input to using X. The problem is that both RPC and X require a callback-handling loop. I can see how to do this if I want to poll both the RPC port and the X event queue, but I do not have anything else to do in the program and do not want to waste CPU for an idle loop. What I need is either: 1. The ability to tell XtMainLoop to look for an RPC request while looking for X events, and have it call an appropriate callback. or 2. The capability to wait for either an RPC request or an X event and calling the appropriate procedure to handle the RPC request or the X event depending on what was pending. This is similar to what I do no for stdin, but I have a feeling that this is not PC in X. For example: main() { int imask; svc_register (...); for (;;) { imask = (svc_fds | x_file_descriptor_set_address); if (select (32, &imask, NULL, NULL, NULL) == -1); continue; if (imask & x_file_descriptor_set_address) handle_x_event(); if (imask & svc_fds) svc_getreq (imask); } } or 3. Maybe you have a better idea. If anyone has any ideas or knows of somewhere to look for more information, please let me know. Thanks, -- Vasile