Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > On Fri, 24 May 2013 08:09:21 -0500 > > -sem_t *lxc_newlock(const char *name) > > +struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name) > > { > > - char *lname; > > - sem_t *lock; > > + struct lxc_lock *l; > > + int ret = pthr

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Serge Hallyn
Oh, but OTOH, making two of the lock functions member functions of the container struct encourages applications to use them - which we may not want. -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the on

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > I think the names you've got are fine (don't really have a better > idea), I do think its good to name locks by what they cover. Its a bit > tricky here because one is a process (and thread) lock and the other > is just a thread lock and it would be

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Dwight Engen
On Fri, 24 May 2013 10:40:30 -0500 Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): > > On Fri, 24 May 2013 08:23:57 -0500 > > Serge Hallyn wrote: > > > > > Quoting Serge Hallyn (serge.hal...@ubuntu.com): > > > > The problem: if a task is killed while holding a posix > > >

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Dwight Engen
On Fri, 24 May 2013 08:09:21 -0500 Serge Hallyn wrote: > The problem: if a task is killed while holding a posix semaphore, > there appears to be no way to have the semaphore be reliably > autmoatically released. The only trick which seemed promising > is to store the pid of the lock holder in so

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > On Fri, 24 May 2013 08:23:57 -0500 > Serge Hallyn wrote: > > > Quoting Serge Hallyn (serge.hal...@ubuntu.com): > > > The problem: if a task is killed while holding a posix semaphore, > > > there appears to be no way to have the semaphore be reliab

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Dwight Engen
On Fri, 24 May 2013 08:23:57 -0500 Serge Hallyn wrote: > Quoting Serge Hallyn (serge.hal...@ubuntu.com): > > The problem: if a task is killed while holding a posix semaphore, > > there appears to be no way to have the semaphore be reliably > > autmoatically released. The only trick which seemed

Re: [lxc-devel] [RFC PATCH] lxclock: Replace named sempahore with flock

2013-05-24 Thread Serge Hallyn
Quoting Serge Hallyn (serge.hal...@ubuntu.com): > The problem: if a task is killed while holding a posix semaphore, > there appears to be no way to have the semaphore be reliably > autmoatically released. The only trick which seemed promising > is to store the pid of the lock holder in some file a