Creating a file and checking for its presence is not an atomic operation.
Use the semaphore mechanism (man semget(2)/semop(2), or if POSIX-semaphores are available under slugosBE, sem_overview(7))
Regards
Roland
--- In nslu2-linux@yahoogroups.com, "clerew5" <clerew5@...> wrote:
>
> I have a resource (an EEPROM on the i2cbus that I have brought out) that needs to be accessed by a server and various subsidiary programs. I had hoped to arrange for the mutex in the kernel thst is part of the i2c device driver to keep them from treading on each other, but there are problems there (which I am still working on).
>
> So can lockfiles be reliably used for the purpose. I.e., is creating a file an atomic process such that if process A creates it and process B tries to create/access it a moment later, will process B always see that it is already there? I see that there is a special add-on that can be used to create lockfiles, but that seems to be aimed at complicated situations involving NFS. In my case, both A and B are running on the slug.
>
> I am using slugosBE v 5.3.
>
Friday, March 2, 2012
[nslu2-linux] Re: Lockfiles
__._,_.___
.
__,_._,___
No comments:
Post a Comment