[lkml]   [1998]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: threads and file locking doesn't work correct wrote:

    > I have a big problem with file locking and threads under Linux.
    > Before I start threads, I create a pid file which will be locked with fcntl.
    > After killing the program (killall or Ctrl-C), the lock will not be
    > removed always. When starting the program again, I get the error message,
    > that pid <xxx> owns the lock, but there is no program running with this pid.

    You didn't mention which kernel you're using, but people are aware of the
    problems with locking and threads. 2.1.88 includes a patch to split the lock
    removal code into two parts as a first step in addressing the problem.
    POSIX-style locks need a further change to consider the lock as associated with
    an fd-array rather than a pid, as all clone tasks (threads) will share one fd
    array. Flock-style locks should be removed correctly when the last close of the
    file structure occurs.

    I've also just posted a patch to test for remaining locks on unused inodes to
    make sure this isn't occurring.

    > Any chance to fix this ? I need threads and file locking.

    Yes, excellent chances of getting it fixed -- this is Linux.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to

     \ /
      Last update: 2005-03-22 13:41    [W:0.038 / U:73.388 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site