Larry Finger wrote:
If a particular routine needs to lock a mutex, but it may be entered with that
mutex already locked,
would the following code be SMP safe?
hold_lock = mutex_trylock()
The common way to deal with this is first to restructure your function
into two. One always acquires the
On 29-11-2007 03:34, David Schwartz wrote:
>> Thanks for the help. Someday, I hope to understand this stuff.
>>
>> Larry
>
> Any code either deals with an object or it doesn't. If it doesn't deal with
> that object, it should not be acquiring locks on that object. If it does
> deal with that objec
On Wed, Nov 28, 2007 at 03:33:12PM -0800, Stephen Hemminger wrote:
...
> WTF are you teaching a lesson on how NOT to do locking?
>
> Any code which has this kind of convoluted dependency on conditional
> locking is fundamentally broken.
>
As a matter of fact I've been thinking, about one more Re
> Thanks for the help. Someday, I hope to understand this stuff.
>
> Larry
Any code either deals with an object or it doesn't. If it doesn't deal with
that object, it should not be acquiring locks on that object. If it does
deal with that object, it must know the internal details of that object,
On Wed, 28 Nov 2007 23:45:13 +0100
Jarek Poplawski <[EMAIL PROTECTED]> wrote:
> Larry Finger wrote, On 11/28/2007 04:41 PM:
>
> > Andreas Schwab wrote:
> >> Larry Finger <[EMAIL PROTECTED]> writes:
> >>
> >>> If a particular routine needs to lock a mutex, but it may be entered with
> >>> that mu
Jarek Poplawski wrote, On 11/28/2007 11:56 PM:
> Jarek Poplawski wrote, On 11/28/2007 11:45 PM:
>
>> Larry Finger wrote, On 11/28/2007 04:41 PM:
>>
>>> Andreas Schwab wrote:
Larry Finger <[EMAIL PROTECTED]> writes:
> If a particular routine needs to lock a mutex, but it may be enter
Jarek Poplawski wrote, On 11/28/2007 11:45 PM:
> Larry Finger wrote, On 11/28/2007 04:41 PM:
>
>> Andreas Schwab wrote:
>>> Larry Finger <[EMAIL PROTECTED]> writes:
>>>
If a particular routine needs to lock a mutex, but it may be entered with
that mutex already locked,
would the f
Larry Finger wrote, On 11/28/2007 04:41 PM:
> Andreas Schwab wrote:
>> Larry Finger <[EMAIL PROTECTED]> writes:
>>
>>> If a particular routine needs to lock a mutex, but it may be entered with
>>> that mutex already locked,
>>> would the following code be SMP safe?
>>>
>>> hold_lock = mutex_trylo
Andreas Schwab wrote:
> Larry Finger <[EMAIL PROTECTED]> writes:
>
>> If a particular routine needs to lock a mutex, but it may be entered with
>> that mutex already locked,
>> would the following code be SMP safe?
>>
>> hold_lock = mutex_trylock()
>>
>> ...
>>
>> if (hold_lock)
>> mutex_unl
Larry Finger <[EMAIL PROTECTED]> writes:
> If a particular routine needs to lock a mutex, but it may be entered with
> that mutex already locked,
> would the following code be SMP safe?
>
> hold_lock = mutex_trylock()
>
> ...
>
> if (hold_lock)
> mutex_unlock()
When two CPUs may enter the
El Wed, Nov 28, 2007 at 08:46:51AM -0600 Larry Finger ha dit:
> Matthias Kaehlcke wrote:
> > El Tue, Nov 27, 2007 at 10:37:00PM -0600 Larry Finger ha dit:
> >
> >> If a particular routine needs to lock a mutex, but it may be entered with
> >> that mutex already locked,
> >> would the following c
Matthias Kaehlcke wrote:
> El Tue, Nov 27, 2007 at 10:37:00PM -0600 Larry Finger ha dit:
>
>> If a particular routine needs to lock a mutex, but it may be entered with
>> that mutex already locked,
>> would the following code be SMP safe?
>>
>> hold_lock = mutex_trylock()
>>
>> ...
>>
>> if (hold
El Tue, Nov 27, 2007 at 10:37:00PM -0600 Larry Finger ha dit:
> If a particular routine needs to lock a mutex, but it may be entered with
> that mutex already locked,
> would the following code be SMP safe?
>
> hold_lock = mutex_trylock()
>
> ...
>
> if (hold_lock)
> mutex_unlock()
this
Robert Hancock wrote:
> Larry Finger wrote:
>> If a particular routine needs to lock a mutex, but it may be entered
>> with that mutex already locked,
>> would the following code be SMP safe?
>>
>> hold_lock = mutex_trylock()
>>
>> ..
>>
>> if (hold_lock)
>> mutex_unlock()
>
> Not if another t
Larry Finger wrote:
If a particular routine needs to lock a mutex, but it may be entered with that
mutex already locked,
would the following code be SMP safe?
hold_lock = mutex_trylock()
..
if (hold_lock)
mutex_unlock()
Not if another task could be acquiring that lock at the same ti
15 matches
Mail list logo