Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425125

Re: initialize a mutex into locked state?

From Oleg Drokin <green@linuxhacker.ru>
Newsgroups linux.kernel
Subject Re: initialize a mutex into locked state?
Date 2016-06-17 16:20 +0200
Message-ID <rL2MN-7BC-1@gated-at.bofh.it> (permalink)
References <rKnJE-62T-11@gated-at.bofh.it> <rKXk5-46B-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Jun 17, 2016, at 4:25 AM, Peter Zijlstra wrote:

> On Wed, Jun 15, 2016 at 02:23:35PM -0400, Oleg Drokin wrote:
>> Hello!
>> 
>>  To my surprise I found out that it's not possible to initialise a mutex into
>>  a locked state.
>>  I discussed it with Arjan and apparently there's no fundamental reason
>>  not to allow this.
> 
> There is. A mutex _must_ have an owner. If you can initialize it in
> locked state, you could do so statically, ie. outside of the context of
> a task.

What's wrong with disallowing only static initializers, but allowing dynamic ones?
Then there is a clear owner.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-15 20:30 +0200
  Re: initialize a mutex into locked state? Peter Zijlstra <peterz@infradead.org> - 2016-06-17 10:30 +0200
    Re: initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-17 16:20 +0200
      Re: initialize a mutex into locked state? Peter Zijlstra <peterz@infradead.org> - 2016-06-17 16:20 +0200
        Re: initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-17 16:30 +0200
          Re: initialize a mutex into locked state? Peter Zijlstra <peterz@infradead.org> - 2016-06-17 16:40 +0200
            Re: initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-17 16:50 +0200
              Re: initialize a mutex into locked state? Jeff Layton <jlayton@poochiereds.net> - 2016-06-17 16:50 +0200
                Re: initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-17 17:00 +0200
                Re: initialize a mutex into locked state? Arjan van de Ven <arjan@linux.intel.com> - 2016-06-17 17:00 +0200
              Re: initialize a mutex into locked state? Peter Zijlstra <peterz@infradead.org> - 2016-06-17 17:10 +0200
          Re: initialize a mutex into locked state? Oleg Drokin <green@linuxhacker.ru> - 2016-06-17 16:50 +0200

csiph-web