Topic: interest in is_recursive_mutex type trait
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sat, 23 Mar 2013 18:17:01 +0100
Raw View
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"><</span><span class=3D"keyword">typename</span=
> <span class=3D"identifier">L</span><span class=3D"special">></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;></span>
<span class=3D"keyword">class</span> <span class=3D"identifier">is_recu=
rsive_mutex</span><span class=3D"special"><</span><span class=3D"identif=
ier">recursive_mutex</span><span class=3D"special">>:</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;></span>
<span class=3D"keyword">class</span> <span class=3D"identifier">is_recu=
rsive_mutex</span><span class=3D"special"><</span><span class=3D"identif=
ier">timed_recursive_mutex</span><span class=3D"special">>:</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 />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
<br />
<br />
--------------020300010208080507060104--
.