From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,82e2620656d159df,start X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-06-22 07:38:14 PST Newsgroups: comp.unix.osf.misc Path: gmd.de!xlink.net!howland.reston.ans.net!noc.near.net!uunet!psinntp!ctp!dmcco From: dmcco@ctp.com (David McCowan) Subject: semop and threads Message-ID: <1993Jun22.134934.9803@ctp.com> Organization: Cambridge Technology Partners Date: Tue, 22 Jun 1993 13:49:34 GMT To DCE Community, >Most of the software assets assume you are using their "event loop mechanism" >which uses semop() to create an environment for the program where there is only >one blocking -- namely this semop() command (exactly like an X event loop -- in >fact, if you use X and this software, it assumes the responsibilities of the X >event loop). The program continuely loops, waiting for any pre-defined event, >(such as a SIGALRM signal from a timer function -- one of the assets they >wrote). When the event is received, a chuck of code is executed to deal with >the event and the program goes back to waiting (at the semop system call). >In our environment this seems to effectively prohibit the use of threads >because even if you create a thread to deal with the event and immediately >go back to the loop, the semop() call blocks the process and consequently >the thread you just created. In other words, as I understand it, this >program architecture as implemented using semop() makes parallelism impossible >and hence defeats a fundamental advantage of DCE. > >AND IF all this is in fact true, does it not mean you cannot mix X-windows >and threads in the same binary ? > First, the semop command that comes with the DCE thread safe library is NOT a blocking call. I ran a test program that created a thread and then suspended on a semop call. The thread slept for a few seconds, then issued a semop call of its own to awaken the first thread. I don't know if you can mix X-windows with threads. We had a situation where we wanted the X event loop to interrupt due to an X event or an incoming RPC. We did not have a lot of confidence in threads, so we forked off a process that listened for incoming RPC's and communicated to the parent via pipes. Bye, dmcco@ctp.com