summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-02-03 11:56:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-02-03 11:56:29 +0200
commitf2b9bf3f35526ed4a5d6c359be1cb1293cacafdf (patch)
tree1cdd814ae99dfef280b0a3ad65b3f9f13e9ecb6c
parent4af1715d32dea19a2a778387a60ad6d42613da0c (diff)
Lock the grammar pool in the example
-rw-r--r--examples/cxx/tree/embedded/driver.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/cxx/tree/embedded/driver.cxx b/examples/cxx/tree/embedded/driver.cxx
index 3c49702..6e31d3b 100644
--- a/examples/cxx/tree/embedded/driver.cxx
+++ b/examples/cxx/tree/embedded/driver.cxx
@@ -71,6 +71,14 @@ main (int argc, char* argv[])
return 1;
}
+ // Lock the grammar pool. This is necessary if we plan to use the
+ // same grammar pool in multiple threads (this way we can reuse the
+ // same grammar in multiple parsers). Locking the pool disallows any
+ // modifications to the pool, such as an attempt by one of the threads
+ // to cache additional schemas.
+ //
+ gp->lockPool ();
+
// Get an implementation of the Load-Store (LS) interface.
//
const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull};