Re: Locking around

2008-08-07 Thread [EMAIL PROTECTED]
On Aug 6, 8:33 pm, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Tobiah <[EMAIL PROTECTED]> writes: > > On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > > Do you think you could use an SQL database on the network to > > handle the locking? > > Yeah, I could. It wouldn't even have to be over

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Tobiah <[EMAIL PROTECTED]> writes: > On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > >> Hello, >> >> I need to synchronize the access to a couple of hundred-thousand >> files[1]. It seems to me that creating one lock object for each of the >> files is a waste of resources, but I cannot

Re: Locking around

2008-08-06 Thread Tobiah
On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > Hello, > > I need to synchronize the access to a couple of hundred-thousand > files[1]. It seems to me that creating one lock object for each of the > files is a waste of resources, but I cannot use a global lock for all > of them either

Re: Locking around

2008-08-06 Thread MRAB
On Aug 6, 1:33 pm, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > Freaky... I just posted nearly this exact solution. > > > I have a couple comments.  First, the call to acquire should come > > before the try block.  If the acquire were to fail, you wouldn't w

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Carl Banks <[EMAIL PROTECTED]> writes: > Freaky... I just posted nearly this exact solution. > > I have a couple comments. First, the call to acquire should come > before the try block. If the acquire were to fail, you wouldn't want > to release the lock on cleanup. > > Second, you need to change

Re: Locking around

2008-08-06 Thread Carl Banks
On Aug 6, 6:34 am, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Nikolaus Rath <[EMAIL PROTECTED]> writes: > >> This should work, at least the idea is not flawed. However, I'd say > >> there are too many locks involved. Rather, you just need a simple > >> flag and the global lock. Further, you need a

Re: Locking around

2008-08-06 Thread Carl Banks
On Aug 4, 9:30 am, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Hello, > > I need to synchronize the access to a couple of hundred-thousand > files[1]. It seems to me that creating one lock object for each of the > files is a waste of resources, but I cannot use a global lock for all > of them either

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Nikolaus Rath <[EMAIL PROTECTED]> writes: >> This should work, at least the idea is not flawed. However, I'd say >> there are too many locks involved. Rather, you just need a simple >> flag and the global lock. Further, you need a condition/event that >> tells waiting threads that you released some

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Ulrich Eckhardt <[EMAIL PROTECTED]> writes: > Nikolaus Rath wrote: >> I need to synchronize the access to a couple of hundred-thousand >> files[1]. It seems to me that creating one lock object for each of the >> files is a waste of resources, but I cannot use a global lock for all >> of them either

Re: Locking around

2008-08-06 Thread Ulrich Eckhardt
Nikolaus Rath wrote: > I need to synchronize the access to a couple of hundred-thousand > files[1]. It seems to me that creating one lock object for each of the > files is a waste of resources, but I cannot use a global lock for all > of them either (since the locked operations go over the network,

Locking around

2008-08-04 Thread Nikolaus Rath
Hello, I need to synchronize the access to a couple of hundred-thousand files[1]. It seems to me that creating one lock object for each of the files is a waste of resources, but I cannot use a global lock for all of them either (since the locked operations go over the network, this would make the