Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#692 closed Bugs (Fixed)

cpp_regex_traits<charT>::toi() method fails in the MT case

Reported by: lsh123 Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

cpp_regex_traits<charT>::toi() method fails to parse
the string correctly when it is used in multi-threaded
environment. Originally, I run into this problem in
regex parser code and traced it down to
cpp_regex_traits<charT>::toi() method (btw, this
happens on Linux only, Windows code goes thru a
different code path). 

I believe that the problem is caused by the fact that
*buffered* m_pimpl->m_sbuf and m_pimpl->m_is are used
inside cpp_regex_traits<charT>::toi() method without
locking. Thus, if two threads are trying to use it in
the same time, it fails.







Attachments (0)

Change History (4)

comment:1 Changed 11 years ago by lsh123

Logged In: YES 
user_id=851494

The attached patch replace cpp_regex_traits<charT>::toi()
implementation with w32_regex_traits<charT>::toi() code.
This completely solves the multithreading problem.

comment:2 Changed 11 years ago by John Maddock

Logged In: YES 
user_id=14804

Confirmed, I'm working on a fix, and updated test cases. 

You can also fix this by defining BOOST_REGEX_USE_C_LOCALE
in boost/regex/user.hpp and rebuilding everything.

John.

comment:3 Changed 11 years ago by John Maddock

Status: assignedclosed
Logged In: YES 
user_id=14804

OK, I've been able to update the regression test suite so it
reproduces the problem, and added the patch attached as a
fix for this, and to generally tighten up const-correctness.

Thanks for the report, John.

comment:4 Changed 11 years ago by lsh123

Logged In: YES 
user_id=851494

Thanks!!!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain nobody.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.