View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0023286 | Open CASCADE | OCCT:Foundation Classes | public | 2012-07-16 14:44 | 2013-04-29 15:21 |
Reporter | kgv | Assigned To | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Platform | A | OS | L | ||
Product Version | 6.5.3 | ||||
Target Version | 6.6.0 | Fixed in Version | 6.6.0 | ||
Summary | 0023286: Standard_Mutex behavior depends on platform | ||||
Description | Standard_Mutex provides system-independent API for thread locking functionality. However it's behavior vary from system: - On Windows critical sections used and allows recursive locks within current thread. - POSIX threads mutex initialized with default options and non-recursive mutex created. This is suggested to initialize recursive POSIX mutex instead to provide the similar behavior on different platforms: > pthread_mutexattr_t anAttr; > pthread_mutexattr_init(&anAttr); > pthread_mutexattr_settype(&anAttr, PTHREAD_MUTEX_RECURSIVE); > pthread_mutex_init(&&myMutex, &anAttr); | ||||
Steps To Reproduce | Standard_Mutex aLock; aLock.Lock(); aLock.Lock(); // recursive lock aLock.Unlock(); aLock.Unlock(); | ||||
Tags | No tags attached. | ||||
Test case number | Not needed | ||||
|
Dear kgv, Fix is integrated into branch СR23286. Please, review. |
|
Dear omy, please consider removing of class Standard_Mutex::SentryNested. It's feature to do not lock mutex (used only in BRepMesh_FastDiscretFace::RestoreStructureFromTriangulation) could be implemented in Standard_Mutex::Sentry. |
|
Dear kgv, The necessary class has been removed. Please, review. |
|
Dear kgv, I've added a check of NULL mutex to Sentry constructor. Please, review. |
|
Dear omy, please do not commit incorrect uncompilable changes. Please rename field nbLocked to more self-descriptional name and make it usage more obvious. Add description for doLock argument. |
|
Dear kgv, I've fixed the errors and tested it on Windows. See the commit message for details. Please, review. |
|
Dear omy, >Standard_Mutex::Sentry aSentry(aMutex == NULL ? NULL : aMutex); please remove this redundant if clause. NULL mutex now handled in Standard_Mutex::Sentry constructor. >static Standard_Mutex DummyMutex; this variable is no in use anymore. Please remove it. > //! Constructor - initializes the sentry object by reference to a > //! mutex (which must be initialized) and locks the mutex if doLock is True > // @param doLock defines whether mutex is able to be locked or not > Sentry (Standard_Mutex* theMutex) there no "doLock" parameter anymore! Please update documentation accordingly. >- Standard_Mutex::SentryNested aSentry1 ( myMutexPools, myReentrant ); >+ Standard_Mutex::Sentry aSentry1 (myMutexPools); Your modifications enforces mutex usage in Standard_MMgrOpt regardless from myReentrant flag. |
|
Dear kgv, I've corrected the mistakes you mentioned. Please, review |
|
Dear omy, >+ if(myReentrant) >+ Standard_Mutex::Sentry aSentry (myMutexPools); This is incorrect solution because sentry will be destroyed immediately at block end (single line after if statement in this case) according to C++ rules. |
|
Dear kgv, I've corrected it. Please, review. |
|
Dear omy, please replace this statement > myReentrant == Standard_True ? &myMutexPools : NULL with more readable > myReentrant ? &myMutexPools : NULL |
|
Dear kgv, I've fixed it. Please, review. |
|
Patch is ready for testing. |
|
Dear BugMaster, Branch CR23286 (and products from occt GIT master) was compiled on Linux and Windows platforms and tested. Regressions: Not detected Improvements: Not detected Testing cases: Not needed |
|
The branch has been rebased on last master under name CR23286_1; old branch CR23286 deleted |
|
Dear BugMaster, Branch CR23286_1 (and products from occt GIT master) was compiled on Linux and Windows platforms and tested. Regressions: Not detected Improvements: Not detected Testing cases: Not needed |
occt: master 49f38e37 2012-11-16 09:14:25
|
0023286: Standard_Mutex behavior depends on platform Implemented recursive POSIX mutex instead of non-recursive, Removed SentryNested class, implemented it's features into Sentry class Added second constructor to Sentry class |
Affected Issues 0023286 |
|
mod - src/BRepMesh/BRepMesh_FastDiscretFace.cxx | Diff File | ||
mod - src/Standard/Standard_MMgrOpt.cxx | Diff File | ||
mod - src/Standard/Standard_Mutex.cxx | Diff File | ||
mod - src/Standard/Standard_Mutex.hxx | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-07-16 14:44 | kgv | New Issue | |
2012-07-16 14:44 | kgv | Assigned To | => abv |
2012-10-20 10:47 |
|
Assigned To | abv => omy |
2012-10-20 10:47 |
|
Status | new => assigned |
2012-10-20 10:47 |
|
Target Version | 6.5.4 => 6.6.0 |
2012-11-02 15:43 |
|
Note Added: 0022082 | |
2012-11-02 15:43 |
|
Assigned To | omy => kgv |
2012-11-02 15:43 |
|
Status | assigned => resolved |
2012-11-02 15:53 |
|
Summary | Standard_Mutex behavior depends from platform => Standard_Mutex behavior depends on platform |
2012-11-02 17:12 | kgv | Note Added: 0022086 | |
2012-11-02 17:12 | kgv | Assigned To | kgv => omy |
2012-11-02 17:12 | kgv | Status | resolved => assigned |
2012-11-02 18:17 |
|
Note Added: 0022090 | |
2012-11-02 18:17 |
|
Assigned To | omy => kgv |
2012-11-02 18:17 |
|
Status | assigned => resolved |
2012-11-08 15:05 |
|
Note Added: 0022149 | |
2012-11-08 15:05 |
|
Status | resolved => feedback |
2012-11-08 16:20 | kgv | Note Added: 0022151 | |
2012-11-08 16:20 | kgv | Status | feedback => assigned |
2012-11-08 16:20 | kgv | Assigned To | kgv => omy |
2012-11-09 12:33 |
|
Note Added: 0022171 | |
2012-11-09 12:33 |
|
Assigned To | omy => kgv |
2012-11-09 12:33 |
|
Status | assigned => resolved |
2012-11-09 12:52 | kgv | Note Added: 0022172 | |
2012-11-09 12:52 | kgv | Assigned To | kgv => omy |
2012-11-09 12:52 | kgv | Status | resolved => assigned |
2012-11-09 14:31 |
|
Note Added: 0022177 | |
2012-11-09 14:31 |
|
Assigned To | omy => kgv |
2012-11-09 14:31 |
|
Status | assigned => resolved |
2012-11-09 14:36 | kgv | Note Added: 0022178 | |
2012-11-09 14:36 | kgv | Assigned To | kgv => omy |
2012-11-09 14:36 | kgv | Status | resolved => assigned |
2012-11-09 15:05 |
|
Note Added: 0022185 | |
2012-11-09 15:05 |
|
Assigned To | omy => kgv |
2012-11-09 15:05 |
|
Status | assigned => resolved |
2012-11-09 16:47 | kgv | Note Added: 0022192 | |
2012-11-09 16:47 | kgv | Assigned To | kgv => omy |
2012-11-09 16:47 | kgv | Status | resolved => assigned |
2012-11-09 17:40 |
|
Note Added: 0022193 | |
2012-11-09 17:40 |
|
Assigned To | omy => kgv |
2012-11-09 17:40 |
|
Status | assigned => resolved |
2012-11-09 18:15 | kgv | Note Added: 0022194 | |
2012-11-09 18:15 | kgv | Assigned To | kgv => bugmaster |
2012-11-09 18:15 | kgv | Status | resolved => reviewed |
2012-11-12 17:28 |
|
Assigned To | bugmaster => mkv |
2012-11-13 12:47 |
|
Note Added: 0022225 | |
2012-11-13 12:48 |
|
Test case number | => Not needed |
2012-11-13 12:48 |
|
Assigned To | mkv => bugmaster |
2012-11-13 12:48 |
|
Status | reviewed => tested |
2012-11-21 11:55 |
|
Note Added: 0022328 | |
2012-11-21 16:52 |
|
Note Edited: 0022225 | |
2012-11-22 11:35 |
|
Note Added: 0022348 | |
2012-11-26 15:45 |
|
Changeset attached | => occt master 49f38e37 |
2012-11-26 15:45 |
|
Assigned To | bugmaster => omy |
2012-11-26 15:45 |
|
Status | tested => verified |
2012-11-26 15:45 |
|
Resolution | open => fixed |
2012-12-10 17:16 |
|
Changeset attached | => occt master 49f38e37 |
2013-04-23 13:36 |
|
Status | verified => closed |
2013-04-29 15:21 |
|
Fixed in Version | => 6.6.0 |