From 97cdaca028e723dea3bc768bb87fa0db0e783c53 Mon Sep 17 00:00:00 2001 From: "William E. Kempf" Date: Wed, 10 Apr 2002 22:08:15 +0000 Subject: [PATCH] Boost.Threads documentation updates. [SVN r13439] --- doc/mutex.html | 409 +++++++++++++++++++++---------------------------- 1 file changed, 175 insertions(+), 234 deletions(-) diff --git a/doc/mutex.html b/doc/mutex.html index 6a97b3f7..4fb13efe 100644 --- a/doc/mutex.html +++ b/doc/mutex.html @@ -1,159 +1,129 @@ - - - - - - Boost.Threads, mutex - - - - - - - - - -
-

C++ Boost

-
-

Boost.Threads

- -

mutex
- try_mutex
- timed_mutex

-
-
- -

Introduction
- Header
- Class mutex Synopsis
- Class mutex Members
- Class try_mutex Synopsis
- Class try_mutex Members
- Class timed_mutex Synopsis
- Class timed_mutex Members
- Example

- -

Introduction

- -

The mutex, try_mutex and timed_mutex classes define full - featured models of the Mutex, + + +Boost.Threads - Header <boost/thread/mutex.hpp> + + + + + + + +
+

C++ Boost

+
+

Boost.Threads

+

Header <boost/thread/mutex.hpp>

+
+


+

Contents

+
+
Introduction
+
Classes
+
+
Class mutex
+
+
Class mutex synopsis
+
Class mutex constructors and + destructor
+
+
+
+
Class try_mutex
+
+
Class try_mutex synopsis
+
Class try_mutex constructors + and destructor
+
+
+
+
Class timed_mutex
+
+
Class timed_mutex + synopsis
+
Class timed_mutex constructors + and destructor
+
+
+
Example(s)
+
+
+

Introduction

+

The mutex, try_mutex and timed_mutex classes define full featured + models of the Mutex, TryMutex, and TimedMutex concepts. These types - should be used to non-recursively synchronize access to shared - resources. For recursive locking mechanics, see TimedMutex concepts. These types should + be used to non-recursively synchronize access to shared resources. For recursive + locking mechanics, see recursive mutexes.

- -

Each class supplies one or more typedefs for lock types which model - matching lock concepts. For the best possible performance you should - use the mutex class that supports the minimum set of lock types that - you need.

- - - - - - - - - - - - - - - - - - + +
Mutex ClassLock nameImplementation defined Lock TypeLock Concept
- mutexscoped_lock - boost::Each class supplies one or more typedefs for lock types which model matching + lock concepts. For the best possible performance you should use the mutex class + that supports the minimum set of lock types that you need.

+ + + + + + + + + + + - - - - - - - - - - + + + + + - - - - - - - - - - + + + + + + - - - -
Mutex ClassLock nameImplementation defined Lock TypeLock Concept
mutexscoped_lock boost::detail::thread::scoped_lock<mutex> - ScopedLock
- try_mutex scoped_lock
- scoped_try_lock
- boost:: ScopedLock
try_mutex + scoped_lock
+ scoped_try_lock
boost::detail::thread::scoped_lock<try_mutex>
- -
- boost::detail::thread::scoped_try_lock<try_mutex>
- ScopedLock
- - ScopedTryLock
- timed_mutex scoped_lock
- scoped_try_lock
- scoped_timed_lock
- boost:: boost::detail::thread::scoped_try_lock<try_mutex> ScopedLock
+ ScopedTryLock
timed_mutex + scoped_lock
+ scoped_try_lock
+ scoped_timed_lock
boost::detail::thread::scoped_lock<timed_mutex>
- - boost::boost::detail::thread::scoped_try_lock<timed_mutex>
- - boost::boost::detail::thread::scoped_timed_lock<timed_mutex>
- ScopedLock
- - ScopedTryLock
- - ScopedTimedLock
- -

The mutex, try_mutex and timed_mutex - classes use an Unspecified locking strategy, so - attempts to recursively lock them or attempts to unlock them by threads - that don't own a lock on them result in undefined behavior. - This strategy allows implementations to be as efficient as possible on - any given platform. It is, however, recommended that implementations - include debugging support to detect misuse when NDEBUG is not - defined.

- -

Like all the Boost.Threads mutex - models, the mutex, try_mutex and - timed_mutex leave the scheduling policy as - Unspecified. Programmers should assume that threads waiting for a - lock on objects of these types acquire the lock in a random order, even - though the specific behavior for a given platform may be different.

- -

Header

-
-#include <boost/thread/mutex.hpp>
-
- -

Class mutex Synopsis

+
ScopedLock
+ ScopedTryLock
+ ScopedTimedLock
+

The mutex, try_mutex and timed_mutex + classes use an Unspecified locking + strategy, so attempts to recursively lock them or attempts to unlock them + by threads that don't own a lock on them result in undefined behavior. + This strategy allows implementations to be as efficient as possible on any given + platform. It is, however, recommended that implementations include debugging + support to detect misuse when NDEBUG is not defined.

+

Like all the Boost.Threads mutex models, + the mutex, try_mutex and timed_mutex + leave the scheduling policy + as Unspecified. Programmers should assume that threads waiting + for a lock on objects of these types acquire the lock in a random order, even + though the specific behavior for a given platform may be different.

+

Classes

+

Class mutex

+

{{class overview text}}

+

Class mutex synopsis

 namespace boost
 {
@@ -169,40 +139,32 @@ namespace boost
         mutex();
         ~mutex();
     };
-}
+};
 
- -

Class mutex Members

-
- -

Constructor

+

Class mutex constructors and + destructor

-    mutex();
+mutex();
 
- -

Postconditions: *this is in the unlocked - state.

-
- -

Destructor

+
+
Postconditions: *this is in an unlocked state.
+
-    ~mutex();
+~mutex();
 
- -

Requires: *this is in the unlocked state.

- -

Effects: Destroys *this.

- -

Dangers: Destruction of a locked mutex is a serious - programming error resulting in undefined behavior such as a program - crash.

-
- -

Class try_mutex Synopsis

+
+
Requires: *this is in an unlocked sate.
+
Danger: Destruction of a locked mutex is a serious programming error + resulting in undefined behavior such as a program crash.
+
+

Class try_mutex

+

{{class overview text}}

+

Class try_mutex synopsis

 namespace boost
 {
-    class try_mutex : private boost::noncopyable // Exposition only.
+    class try_mutex : private boost::noncopyable // Exposition only.
         // Class try_mutex meets the NonCopyable requirement.
     {
@@ -215,40 +177,32 @@ namespace boost
         try_mutex();
         ~try_mutex();
     };
-}
+};
 
- -

Class try_mutex Members

-
- -

Constructor

+

Class try_mutex constructors + and destructor

-    try_mutex();
+try_mutex();
 
- -

Postconditions: *this is in the unlocked - state.

-
- -

Destructor

+
+
Postconditions: *this is in an unlocked state.
+
-    ~try_mutex();
+~try_mutex();
 
- -

Requires: *this is in the unlocked state.

- -

Effects: Destroys *this.

- -

Dangers: Destruction of a locked mutex is a serious - programming error resulting in undefined behavior such as a program - crash.

-
- -

Class timed_mutex Synopsis

+
+
Requires: *this is in an unlocked sate.
+
Danger: Destruction of a locked mutex is a serious programming error + resulting in undefined behavior such as a program crash.
+
+

Class timed_mutex

+

{{class overview text}}

+

Class timed_mutex synopsis

 namespace boost
 {
-    class timed_mutex : private boost::noncopyable // Exposition only.
+    class timed_mutex : private boost::noncopyable // Exposition only.
         // Class timed_mutex meets the NonCopyable requirement.
     {
@@ -263,36 +217,25 @@ namespace boost
         timed_mutex();
         ~timed_mutex();
     };
-}
+};
 
- -

Class timed_mutex Members

-
- -

Constructor

+

Class timed_mutex constructors + and destructor

-    timed_mutex();
+timed_mutex();
 
- -

Postconditions: *this is in the unlocked - state.

-
- -

Destructor

+
+
Postconditions: *this is in an unlocked state.
+
-    ~timed_mutex();
+~timed_mutex();
 
- -

Requires: *this is in the unlocked state.

- -

Effects: Destroys *this.

- -

Dangers: Destruction of a locked mutex is a serious - programming error resulting in undefined behavior such as a program - crash.

-
- -

Example Usage

+
+
Requires: *this is in an unlocked sate.
+
Danger: Destruction of a locked mutex is a serious programming error + resulting in undefined behavior such as a program crash.
+
+

Example(s)

 #include <boost/thread/mutex.hpp>
@@ -339,21 +282,19 @@ int main(int, char*[])
     return 0;
 }
 
- -

The output is:

+

The output is:

 count == 1
 count == 2
 count == 3
 count == 4
 
-
- -

Revised - 05 November, 2001

- -

© Copyright - William E. Kempf 2001 all rights reserved.

- +

Revised + + 05 November, 2001 + +

+

© Copyright William E. Kempf 2002. All Rights + Reserved.

+ -