[Pcre-svn] [410] code/trunk/doc/pcre2serialize.3: Document r…

Inizio della pagina
Delete this message
Autore: Subversion repository
Data:  
To: pcre-svn
Oggetto: [Pcre-svn] [410] code/trunk/doc/pcre2serialize.3: Document race issue for pcre2_code_free() after serialize/deserialize.
Revision: 410
          http://www.exim.org/viewvc/pcre2?view=rev&revision=410
Author:   ph10
Date:     2015-11-03 18:40:28 +0000 (Tue, 03 Nov 2015)
Log Message:
-----------
Document race issue for pcre2_code_free() after serialize/deserialize.


Modified Paths:
--------------
    code/trunk/doc/pcre2serialize.3


Modified: code/trunk/doc/pcre2serialize.3
===================================================================
--- code/trunk/doc/pcre2serialize.3    2015-11-03 17:38:00 UTC (rev 409)
+++ code/trunk/doc/pcre2serialize.3    2015-11-03 18:40:28 UTC (rev 410)
@@ -1,4 +1,4 @@
-.TH PCRE2SERIALIZE 3 "20 January 2015" "PCRE2 10.10"
+.TH PCRE2SERIALIZE 3 "03 November 2015" "PCRE2 10.21"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS"
@@ -22,12 +22,12 @@
 expression patterns, it may be useful to store them in a precompiled form
 instead of having to compile them every time the application is run. However,
 if you are using the just-in-time optimization feature, it is not possible to
-save and reload the JIT data, because it is position-dependent. In addition,
-the host on which the patterns are reloaded must be running the same version of
-PCRE2, with the same code unit width, and must also have the same endianness,
-pointer width and PCRE2_SIZE type. For example, patterns compiled on a 32-bit
-system using PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor
-can they be reloaded using the 8-bit library.
+save and reload the JIT data, because it is position-dependent. The host on
+which the patterns are reloaded must be running the same version of PCRE2, with
+the same code unit width, and must also have the same endianness, pointer width
+and PCRE2_SIZE type. For example, patterns compiled on a 32-bit system using
+PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor can they be
+reloaded using the 8-bit library.
 .
 .
 .SH "SAVING COMPILED PATTERNS"
@@ -139,10 +139,15 @@
 on a system with different endianness.
 .P
 Decoded patterns can be used for matching in the usual way, and must be freed
-by calling \fBpcre2_code_free()\fP as normal. A single copy of the character
-tables is used by all the decoded patterns. A reference count is used to
+by calling \fBpcre2_code_free()\fP. However, be aware that there is a potential
+race issue if you are using multiple patterns that were decoded from a single 
+byte stream in a multithreaded application. A single copy of the character
+tables is used by all the decoded patterns and a reference count is used to
 arrange for its memory to be automatically freed when the last pattern is
-freed.
+freed, but there is no locking on this reference count. Therefore, if you want
+to call \fBpcre2_code_free()\fP for these patterns in different threads, you
+must arrange your own locking, and ensure that \fBpcre2_code_free()\fP cannot 
+be called by two threads at the same time.
 .P
 If a pattern was processed by \fBpcre2_jit_compile()\fP before being
 serialized, the JIT data is discarded and so is no longer available after a
@@ -165,6 +170,6 @@
 .rs
 .sp
 .nf
-Last updated: 20 January 2015
+Last updated: 03 November 2015
 Copyright (c) 1997-2015 University of Cambridge.
 .fi