Skip to content

Commit

Permalink
Document that the POSIX API is not thread-safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipHazel committed Nov 14, 2023
1 parent 183e8a9 commit eca3f2b
Show file tree
Hide file tree
Showing 6 changed files with 1,543 additions and 1,512 deletions.
4 changes: 2 additions & 2 deletions doc/html/pcre2api.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ <h1>pcre2api man page</h1>
PCRE2 has its own native API, which is described in this document. There are
also some wrapper functions for the 8-bit library that correspond to the
POSIX regular expression API, but they do not give access to all the
functionality of PCRE2. They are described in the
functionality of PCRE2 and they are not thread-safe. They are described in the
<a href="pcre2posix.html"><b>pcre2posix</b></a>
documentation. Both these APIs define a set of C function calls.
</P>
Expand Down Expand Up @@ -4140,7 +4140,7 @@ <h1>pcre2api man page</h1>
</P>
<br><a name="SEC43" href="#TOC1">REVISION</a><br>
<P>
Last updated: 11 November 2023
Last updated: 14 November 2023
<br>
Copyright &copy; 1997-2023 University of Cambridge.
<br>
Expand Down
25 changes: 18 additions & 7 deletions doc/html/pcre2posix.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ <h1>pcre2posix man page</h1>
additional functionality.
</P>
<P>
The functions described here are wrapper functions that ultimately call the
PCRE2 native API. Their prototypes are defined in the <b>pcre2posix.h</b> header
file, and they all have unique names starting with <b>pcre2_</b>. However, the
<b>IMPORTANT NOTE</b>: The functions described here are NOT thread-safe, and
should not be used in multi-threaded applications. Use the native API instead.
</P>
<P>
These functions are wrapper functions that ultimately call the PCRE2 native
API. Their prototypes are defined in the <b>pcre2posix.h</b> header file, and
they all have unique names starting with <b>pcre2_</b>. However, the
<b>pcre2posix.h</b> header also contains macro definitions that convert the
standard POSIX names such <b>regcomp()</b> into <b>pcre2_regcomp()</b> etc. This
means that a program can use the usual POSIX names without running the risk of
Expand Down Expand Up @@ -93,6 +97,11 @@ <h1>pcre2posix man page</h1>
</P>
<br><a name="SEC3" href="#TOC1">USING THE POSIX FUNCTIONS</a><br>
<P>
Note that these functions are just POSIX-style wrappers for PCRE2's native API.
They do not give POSIX regular expression behaviour, and they are not
thread-safe.
</P>
<P>
Those POSIX option bits that can reasonably be mapped to PCRE2 native options
have been implemented. In addition, the option REG_EXTENDED is defined with the
value zero. This has no effect, but since programs that are written to the
Expand Down Expand Up @@ -123,8 +132,10 @@ <h1>pcre2posix man page</h1>
internal form. By default, the pattern is a C string terminated by a binary
zero (but see REG_PEND below). The <i>preg</i> argument is a pointer to a
<b>regex_t</b> structure that is used as a base for storing information about
the compiled regular expression. (It is also used for input when REG_PEND is
set.)
the compiled regular expression. It is also used for input when REG_PEND is
set. The <b>regex_t</b> structure used by <b>pcre2_regcomp()</b> is defined in
<b>pcre2posix.h</b> and is not the same as the structure used by other libraries
that provide POSIX-style matching.
</P>
<P>
The argument <i>cflags</i> is either zero, or contains one or more of the bits
Expand Down Expand Up @@ -353,9 +364,9 @@ <h1>pcre2posix man page</h1>
</P>
<br><a name="SEC10" href="#TOC1">REVISION</a><br>
<P>
Last updated: 26 April 2021
Last updated: 14 November 2023
<br>
Copyright &copy; 1997-2021 University of Cambridge.
Copyright &copy; 1997-2023 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE2 index page</a>.
Expand Down
Loading

0 comments on commit eca3f2b

Please sign in to comment.