Hi Roberto, you can do the following: - the only way to do it without polling is to use event handlers (see TSysEvtHandler, TFileHandler,...). These handlers register file descriptors to be monitored by the main eventloop (i.e., the main select()) of the consumer. - another way would be to use user signals SIGUSR1|2 but I think you'll have more than 2 producers. - the consumer starts with registering an event handler for a TServerSocket - when the serversocket eventhander is notified you know a producer wants to connect. You accept and register the eventhandler for the new TSocket - from now on this producer will be monitored by the consumer, as well as the server socker that waits for more producers to connect - when a producers opens a socket connection with the consumer it tells the consumer at which shared file (TMapFile) it should look for that producer. The consumer then opens the specified shared file. - each time the producer wants the consumer to look at the sharedfile it sends a short message on the socket. - in the meanwhile the graphics and other system timers will be correctly handled by the main select() eventloop of the consumer. - when a producer exits, the consumer removes its eventhandler from the list of eventhandlers Hope this is kind of clear :-) Cheers, Fons. PS: to reach the roottalk audience, mail directly to roottalk@root.cern.ch, the message is then also forwarded to the newsgroup, including replies. However, messages to the newsgroup cern.root are not yet forwarded to the mailinglist. USENET News System wrote: > > Dear Rooters, > we need to synchronise a number of processes in a multi-producer, > single-consumer scheme. More in details, we want the consumer to sleep > (or equivalent) and to wakeup once any of the producers has data ready. > One obvious way is to create a socket per producer and then do a select > on all the sockets. Ah, we'd like to keep ROOT as alive as possible, as > the consumer might have to run some intensive graphics. For the exchange > of the actual data, we were thinking to use shared memory. The consumer > must be a ROOT process while the producers might also be simpler C > daemons (although we were thinking of implementing them as ROOT processes). > A final small point: the consumer shall be able to put a timeout on the > wait. > > TIA, > -- > +-----------------------+----------------------------------------------+ > | Roberto Divia` | Love at first sight is one of the greatest | > | ============= | labor-saving devices the world has ever seen | > +-----------------------+----------------------------------------------+ > | CERN : European Laboratory for Particle Physics, 1211 Geneva 23 | > | Switzerland (CH) E-mail: Roberto.Divia@cern.ch | > +----------------------------------------------------------------------+ -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:29 MET