220 3276 <514DE38D.2060605@wanadoo.fr> article
Path: news.gmane.org!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: interest in is_recursive_mutex type trait
Date: Sat, 23 Mar 2013 18:17:01 +0100
Lines: 138
Approved: news@gmane.org
Message-ID: <514DE38D.2060605@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------020300010208080507060104"
X-Trace: ger.gmane.org 1364059022 8234 80.91.229.3 (23 Mar 2013 17:17:02 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 23 Mar 2013 17:17:02 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBDWHW6FAKGQEDCCDANY@isocpp.org Sat Mar 23 18:17:27 2013
Return-path: <std-proposals+bncBDH67CONY4PBBDWHW6FAKGQEDCCDANY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-bk0-f70.google.com ([209.85.214.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH67CONY4PBBDWHW6FAKGQEDCCDANY@isocpp.org>)
	id 1UJS4M-0003Ed-10
	for gclcip-std-proposals@m.gmane.org; Sat, 23 Mar 2013 18:17:26 +0100
Original-Received: by mail-bk0-f70.google.com with SMTP id jk7sf7140472bkc.5
        for <gclcip-std-proposals@m.gmane.org>; Sat, 23 Mar 2013 10:17:02 -0700 (PDT)
X-Received: by 10.180.106.161 with SMTP id gv1mr1542523wib.4.1364059022403;
        Sat, 23 Mar 2013 10:17:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.89.243 with SMTP id br19ls2288883wib.50.canary; Sat, 23
 Mar 2013 10:17:02 -0700 (PDT)
X-Received: by 10.205.40.202 with SMTP id tr10mr2986868bkb.24.1364059021956;
        Sat, 23 Mar 2013 10:17:01 -0700 (PDT)
Original-Received: from smtp.smtpout.orange.fr (smtp06.smtpout.orange.fr. [80.12.242.128])
        by mx.google.com with ESMTP id ha11si2248116bkc.161.2013.03.23.10.17.01;
        Sat, 23 Mar 2013 10:17:01 -0700 (PDT)
Received-SPF: neutral (google.com: 80.12.242.128 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.128;
Original-Received: from iMac-de-Vicente-Botet-Escriba.local ([81.53.182.67])
	by mwinf5d63 with ME
	id F5H11l00B1TfKdt035H1bk; Sat, 23 Mar 2013 18:17:01 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.128 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mail=vicente.botet@wanadoo.fr
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:3276
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/3276>

This is a multi-part message in MIME format.
--------------020300010208080507060104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

The user could require that the mutex passed to an algorithm is a 
recursive one. E.g. providing a io thread safe service needs a recursive 
mutex. If the mutex type is a template parameter it would be great if a 
compile time error is provided when the provided mutex is not recursive.

Whether a lockable is recursive or not can not be checked using template 
meta-programming and is something that the developer states "sur 
parolle". This is the motivation for the following trait.

     template<typename  L>
     class  is_recursive_mutex:  false_type;  // EXTENSION
     template<>
     class  is_recursive_mutex<recursive_mutex>:  true_type;  // EXTENSION
     template<>
     class  is_recursive_mutex<timed_recursive_mutex>:  true_type;

The trait |is_recursive_mutex| is |false_type| by default and is 
specialized for the provide |recursive_mutex| and |timed_recursive_mutex|.

It should be specialized by the user providing other model of recursive 
mutexes; e.g. null_mutex.

Is there an interest on this trait for the standard?

Best regards,
Vicente

P.S. A similar trait is_recursive_mutex_sur_parolle is already included 
in Boost.Thread.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--------------020300010208080507060104
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DISO-8=
859-1">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    Hi,<br>
    <br>
    <meta http-equiv=3D"content-type" content=3D"text/html;
      charset=3DISO-8859-1">
    The user could require that the mutex passed to an algorithm is a
    recursive one. E.g. providing a io thread safe service needs a
    recursive mutex. If the mutex type is a template parameter it would
    be great if a compile time error is provided when the provided mutex
    is not recursive. <br>
    <br>
    Whether a lockable is recursive or not can not be checked using
    template meta-programming and is something that the developer states
    "sur parolle". This is the motivation for the following trait. <br>
    <br>
    <meta http-equiv=3D"content-type" content=3D"text/html;
      charset=3DISO-8859-1">
    <pre class=3D"programlisting">    <span class=3D"keyword">template</spa=
n><span class=3D"special">&lt;</span><span class=3D"keyword">typename</span=
> <span class=3D"identifier">L</span><span class=3D"special">&gt;</span>
    <span class=3D"keyword">class</span> <span class=3D"identifier">is_recu=
rsive_mutex</span><span class=3D"special">:</span> <span class=3D"identifie=
r">false_type</span><span class=3D"special">;</span> <span class=3D"comment=
">// EXTENSION
</span>    <span class=3D"keyword">template</span><span class=3D"special">&=
lt;&gt;</span>
    <span class=3D"keyword">class</span> <span class=3D"identifier">is_recu=
rsive_mutex</span><span class=3D"special">&lt;</span><span class=3D"identif=
ier">recursive_mutex</span><span class=3D"special">&gt;:</span> <span class=
=3D"identifier">true_type</span><span class=3D"special">;</span> <span clas=
s=3D"comment">// EXTENSION
</span>    <span class=3D"keyword">template</span><span class=3D"special">&=
lt;&gt;</span>
    <span class=3D"keyword">class</span> <span class=3D"identifier">is_recu=
rsive_mutex</span><span class=3D"special">&lt;</span><span class=3D"identif=
ier">timed_recursive_mutex</span><span class=3D"special">&gt;:</span> <span=
 class=3D"identifier">true_type</span><span class=3D"special">;</span></pre=
>
    <meta http-equiv=3D"content-type" content=3D"text/html;
      charset=3DISO-8859-1">
    <p> The trait <code class=3D"computeroutput"><span class=3D"identifier"=
>is_recursive_mutex</span></code>
      is <code class=3D"computeroutput"><span class=3D"identifier">false_ty=
pe</span></code>
      by default and is specialized for the provide <code
        class=3D"computeroutput"><span class=3D"identifier">recursive_mutex=
</span></code>
      and <code class=3D"computeroutput"><span class=3D"identifier">timed_r=
ecursive_mutex</span></code>.
    </p>
    <p> It should be specialized by the user providing other model of
      recursive mutexes; e.g. null_mutex.<br>
    </p>
    <p>Is there an interest on this trait for the standard?<br>
    </p>
    <p>Best regards,<br>
      Vicente<br>
    </p>
    <p>P.S. A similar trait is_recursive_mutex_sur_parolle is already
      included in Boost.Thread.<br>
    </p>
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--------------020300010208080507060104--

.
