Files
boost_regex/doc/thread_safety.html
T
John Maddock c8f2ed3bdb Added new docs,
Moved source more into line with the std lib proposal.


[SVN r18292]
2003-04-23 10:49:57 +00:00

67 lines
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Boost.Regex: Thread Safety</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<body>
<P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<TD width="353">
<H1 align="center">Boost.Regex</H1>
<H2 align="center">Thread Safety</H2>
</TD>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
</td>
</TR>
</TABLE>
</P>
<HR>
<p></p>
<P>Class basic_regex&lt;&gt; and its typedefs regex and wregex are thread safe, in
that compiled regular expressions can safely be shared between threads. The
matching algorithms regex_match, regex_search, regex_grep, regex_format and
regex_merge are all re-entrant and thread safe. Class match_results is now
thread safe, in that the results of a match can be safely copied from one
thread to another (for example one thread may find matches and push
match_results instances onto a queue, while another thread pops them off the
other end), otherwise use a separate instance of match_results per thread.
</P>
<P>The POSIX API functions are all re-entrant and thread safe, regular expressions
compiled with <I>regcomp</I> can also be shared between threads.
</P>
<P>The class RegEx is only thread safe if each thread gets its own RegEx instance
(apartment threading) - this is a consequence of RegEx handling both compiling
and matching regular expressions.
</P>
<P>Finally note that changing the global locale invalidates all compiled regular
expressions, therefore calling <I>set_locale</I> from one thread while another
uses regular expressions <I>will</I> produce unpredictable results.
</P>
<P>
There is also a requirement that there is only one thread executing prior to
the start of main().
<P>
<HR>
<P></P>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<P><I>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
and its documentation for any purpose is hereby granted without fee, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
</body>
</html>