Path: utzoo!attcan!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.unix.questions Subject: process sync - can it be portable? Keywords: lock Message-ID: <12992@steinmetz.ge.com> Date: 19 Jan 89 17:30:41 GMT Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp. R & D, Schenectady,NY Lines: 25 I have a program which will eventually run a number of copies all sharing a number of files. My problem comes with locking... I want this to run on as many types of system as possible, without excessive #if's. I need to do a little access syncing with the following requirements: 1) lock with wait - if already locked pause until free 2) self unlocking if the process with the lock dies. Now before I get 20 messages telling me what I already know, YES I can do it on BSD, on SysV, Xenix, Ultrix, and SunOS. What I want is a single portable method which will work from the same source code in each. In the past I've used semiphores, simple locks, fancy locks (just parts of a file), etc, messages, pipes, and shared memory for IPC. The problem is that I want this to be portable. Anyone got a good idea. Note that preserving order on multiple waiting processes is not required. Long before locks become a bottleneck on this program the system will run out of something else. I will summarize mail, but would prefer to have replies posted to simulate other ideas. I'll even take help from one of the "any fool plainly knows that..." types at this point. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me