Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!inkwell!ivan!jhc From: jhc@ivan.uucp (James H. Coombs) Newsgroups: comp.databases Subject: Re: record locking in C-tree on bsd unix Keywords: bsd unix, C-tree Message-ID: <54467@inkwell.UUCP> Date: 25 Jun 91 15:41:24 GMT References: <1991Jun25.091645.28309@ncst.ernet.in> Sender: news@inkwell.UUCP Reply-To: jhc@ivan.UUCP (James H. Coombs) Organization: IRIS - Brown University Lines: 24 In article <1991Jun25.091645.28309@ncst.ernet.in> deepak@ncst.ernet.in (Deepak G Patil) writes: >Does any one know how to lock records in C-tree on bsd unix ? > >to my knowledge to lock records C-tree uses system call, >and bsd unix doesn't support any system call to lock a record in a file, c-tree invokes lockf(). I find that when we were working on the IBM RT, I defined lockf() to (0), but I did not have a multi-user application on that machine. There are many ways to implement locking: 1. Write a lock demon that mediates between processes. 2. Use a multi-threaded server that keeps track of locked records. 3. Put a flag in each record to indicate whether or not it is locked. 4. If simultaneous locking is limited, use flock() and lock the entire table. --Jim