mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-06 04:55:50 +01:00
Defer thread creation in parsebypart example
This commit is contained in:
parent
f54b0e47a0
commit
0f9dbe0a9c
@ -21,12 +21,15 @@ public:
|
||||
AsyncDocumentParser(Document& d)
|
||||
: stream_(*this)
|
||||
, d_(d)
|
||||
, parseThread_(&AsyncDocumentParser::Parse, this)
|
||||
, parseThread_()
|
||||
, mutex_()
|
||||
, notEmpty_()
|
||||
, finish_()
|
||||
, completed_()
|
||||
{}
|
||||
{
|
||||
// Create and execute thread after all member variables are initialized.
|
||||
parseThread_ = std::thread(&AsyncDocumentParser::Parse, this);
|
||||
}
|
||||
|
||||
~AsyncDocumentParser() {
|
||||
if (!parseThread_.joinable())
|
||||
|
Loading…
x
Reference in New Issue
Block a user