Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tbb::interface5::scoped_lock Class Reference

The scoped lock pattern for write locks. More...

#include <reader_writer_lock.h>

Inheritance diagram for tbb::interface5::scoped_lock:
Collaboration diagram for tbb::interface5::scoped_lock:

Public Member Functions

 scoped_lock (reader_writer_lock &lock)
 Construct with blocking attempt to acquire write lock on the passed-in lock. More...
 
 ~scoped_lock ()
 Destructor, releases the write lock. More...
 
voidoperator new (size_t s)
 
void operator delete (void *p)
 

Private Member Functions

 scoped_lock ()
 Construct scoped_lock that is not holding lock. More...
 
void __TBB_EXPORTED_METHOD internal_construct (reader_writer_lock &)
 
void __TBB_EXPORTED_METHOD internal_destroy ()
 
- Private Member Functions inherited from tbb::internal::no_copy
 no_copy (const no_copy &)=delete
 
 no_copy ()=default
 

Private Attributes

reader_writer_lockmutex
 The pointer to the mutex to lock. More...
 
scoped_locknext
 The next queued competitor for the mutex. More...
 
atomic< status_tstatus
 Status flag of the thread associated with this node. More...
 

Friends

class reader_writer_lock
 

Detailed Description

The scoped lock pattern for write locks.

Scoped locks help avoid the common problem of forgetting to release the lock. This type also serves as the node for queuing locks.

Definition at line 100 of file reader_writer_lock.h.

Constructor & Destructor Documentation

tbb::interface5::scoped_lock::scoped_lock ( reader_writer_lock lock)
inline

Construct with blocking attempt to acquire write lock on the passed-in lock.

Definition at line 105 of file reader_writer_lock.h.

References tbb::interface5::internal_construct().

105  {
107  }
void __TBB_EXPORTED_METHOD lock()
Acquires the reader_writer_lock for write.
Definition: mutex.h:157
void __TBB_EXPORTED_METHOD internal_construct(reader_writer_lock &)

Here is the call graph for this function:

tbb::interface5::scoped_lock::~scoped_lock ( )
inline

Destructor, releases the write lock.

Definition at line 110 of file reader_writer_lock.h.

References tbb::interface5::internal_destroy().

110  {
112  }
void __TBB_EXPORTED_METHOD internal_destroy()

Here is the call graph for this function:

tbb::interface5::scoped_lock::scoped_lock ( )
private

Construct scoped_lock that is not holding lock.

Member Function Documentation

void __TBB_EXPORTED_METHOD tbb::interface5::scoped_lock::internal_construct ( reader_writer_lock )
private
void __TBB_EXPORTED_METHOD tbb::interface5::scoped_lock::internal_destroy ( )
private
void tbb::interface5::scoped_lock::operator delete ( void p)
inline

Definition at line 117 of file reader_writer_lock.h.

References tbb::internal::deallocate_via_handler_v3(), and p.

117  {
119  }
void const char const char int ITT_FORMAT __itt_group_sync p
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.

Here is the call graph for this function:

void* tbb::interface5::scoped_lock::operator new ( size_t  s)
inline

Definition at line 114 of file reader_writer_lock.h.

References tbb::internal::allocate_via_handler_v3(), and s.

114  {
116  }
void const char const char int ITT_FORMAT __itt_group_sync s
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class reader_writer_lock
friend

Definition at line 102 of file reader_writer_lock.h.

Member Data Documentation

reader_writer_lock* tbb::interface5::scoped_lock::mutex
private

The pointer to the mutex to lock.

Definition at line 123 of file reader_writer_lock.h.

scoped_lock* tbb::interface5::scoped_lock::next
private

The next queued competitor for the mutex.

Definition at line 125 of file reader_writer_lock.h.

Referenced by tbb::interface5::end_write(), and tbb::interface5::start_write().

atomic<status_t> tbb::interface5::scoped_lock::status
private

Status flag of the thread associated with this node.

Definition at line 127 of file reader_writer_lock.h.

Referenced by tbb::interface5::set_next_writer(), and tbb::interface5::start_write().


The documentation for this class was generated from the following file:

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.