VirtualBox

Ticket #3346 (closed defect: invalid)

Opened 5 years ago

Last modified 5 years ago

implementation check for "RTLock::release"

Reported by: elfring Owned by:
Priority: minor 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

lock.diff Download (380 bytes) - added by elfring 5 years ago.
update suggestion

Change History

Changed 5 years ago by elfring

update suggestion

comment:1 Changed 5 years ago by frank

  • Status changed from new to closed
  • Resolution set to invalid

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 Changed 5 years ago by elfring

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.

www.oracle.com
ContactPrivacy policyTerms of Use