<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">Hi Marshall, Eric,</span></p>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
Currently the libcxx configuration option LIBCXX_ENABLE_THREADS serves two purposes:</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
1. Enabling C++11 threading constructs like std::thread and std::mutex in the library.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
2. Ensuring certain constructs are safe to be used in multi-threaded environments. This is about ensuring that any storage allocated by the library itself is properly protected using mutexes and/or atomic operations. A good example for this is the ref counting
 mechanism of shared_prt<T>.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
(2) is a pre-requisite for (1). But I think (2) should be able to stand on its own even without (1) -  which is currently not possible.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
The use case for us is that there are users who want to use shared_prt<T> (and others) in multi-threaded environments without having to enable high-level threading constructs like std::thread and std::mutex. I would also put std::atomic into the same category;
 these should be available even if std::mutex and std::thread are explicitly disabled in the library.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
Do you think this would be useful to the general audience of libc++? I can spin some patches if so.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
Thanks.</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small;">
/ Asiri</div>
<br>
<p></p>
</div>
</body>
</html>