Opened 7 years ago

Last modified 7 years ago

#11318 closed Support Requests

boost unique_lock has no mutex — at Version 1

Reported by: shyamps@… Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.58.0 Severity: Problem
Keywords: boost unique_lock has no mutex Cc:

Description (last modified by viboes)

This is an issue I am observing in the newly released boost_1_58 library. I suspect the problem may not be boost related, and could be an msvc 12.0 compiler related issue. The symptom I observe is that when a Visual C++ project TURNS ON one of the compiler optimization flags /Og, /O1, /O2 or /Ox Flags, the C++ code that I am using below is throwing an exception:

Below is the sample code I use in the application:

boost::mutex::scoped_lock <Scoped Lock Variable> (<Mutex Object>)

Below is the exception message I am seeing which strangely occurs the second time a scoped lock is called on the same valid Mutex Object within the application:

"boost unique_lock has no mutex"

I am baffled by what causes this problem. When I turn off the optimization flags and execute the program, the application executes flawlessly. Only when I turn on optimization flags, this error consistently occurs. Workaround I am using is to disable optimization Flags for the release version.

Below is my build configuration:

Visual Studio community edition 2013, which uses msvc 12 compiler version; Windows 8.1; boost Library version 1.58

Change History (1)

comment:1 by viboes, 7 years ago

Component: Nonethread
Description: modified (diff)
Owner: set to viboes
Status: newassigned

Please, could you post exactly the code as the following is not valid code

boost::mutex::scoped_lock <Scoped Lock Variable> (<Mutex Object>)
Note: See TracTickets for help on using tickets.