Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What mechanism can be used to take a record lock on a file?

file lock mechanism record Used
0
Posted

What mechanism can be used to take a record lock on a file?

0

> whats mechanism can be used to take a record lock on a file (using the > fcntl() call), in a posix multi threaded application. Seems to me that > these locks are process based, and therfore multiple threads within the same > process are treated as the same thing. > > Any pointer would be appreciated This has been discussed several times before. Yes, fcntl() locks are process-based, for a number of reasons historical and pragmatic. Some people have successfully built a two-level file locking strategy that uses mutexes between threads within a process and fcntl() between processes. Essentially, you reference count the fcntl() lock(s) so that the process holds an fcntl() lock whenever any thread within the process has an area locked; if more than one thread within the process is interested in the same file area, they synchronized among themselves using a mutex. I believe that sample code may have been posted. Search the newsgroup archives, if you can find a good server. (I don’t know wh

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123