VirtualBox

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#3346 closed defect (invalid)

implementation check for "RTLock::release"

Reported by: Markus Elfring Owned by:
Component: other Version: VirtualBox 2.1.2
Keywords: mutual exclusion, concurrency Cc:
Guest type: other Host type: other

Description

I wonder why the assignment to the variable "mfLocked" is performed without mutual exclusion in the implementation of the member function "RTLock::release". It seems that the instruction is one line too late.

Attachments (1)

lock.diff (380 bytes ) - added by Markus Elfring 15 years ago.
update suggestion

Download all attachments as: .zip

Change History (3)

by Markus Elfring, 15 years ago

Attachment: lock.diff added

update suggestion

comment:1 by Frank Mehnert, 15 years ago

Resolution: invalid
Status: newclosed

The order does not matter here. Note that an RTLock object is usually stack-local and therefore thread-local. Therefore there is no race accessing the mfLocked variable. The mutex does not guard that variable but the whole code section between RTLock::RTLock() and RTLock::~RTLock()/RTLock::release().

comment:2 by Markus Elfring, 15 years ago

I guess that it would still be safer to move the assignment for the variable "mfLocked" into the previous lock scope.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use