]> git.sesse.net Git - casparcg/blob - tbb30_20100406oss/include/tbb/null_rw_mutex.h
2.0.2: Updated to boost 1.48.
[casparcg] / tbb30_20100406oss / include / tbb / null_rw_mutex.h
1 /*
2     Copyright 2005-2010 Intel Corporation.  All Rights Reserved.
3
4     This file is part of Threading Building Blocks.
5
6     Threading Building Blocks is free software; you can redistribute it
7     and/or modify it under the terms of the GNU General Public License
8     version 2 as published by the Free Software Foundation.
9
10     Threading Building Blocks is distributed in the hope that it will be
11     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with Threading Building Blocks; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19     As a special exception, you may use this file as part of a free software
20     library without restriction.  Specifically, if other files instantiate
21     templates or use macros or inline functions from this file, or you compile
22     this file and link it with other files to produce an executable, this
23     file does not by itself cause the resulting executable to be covered by
24     the GNU General Public License.  This exception does not however
25     invalidate any other reasons why the executable file might be covered by
26     the GNU General Public License.
27 */
28
29 #ifndef __TBB_null_rw_mutex_H
30 #define __TBB_null_rw_mutex_H
31
32 namespace tbb {
33     
34 //! A rw mutex which does nothing
35 /** A null_rw_mutex is a rw mutex that does nothing and simulates successful operation.
36     @ingroup synchronization */
37 class null_rw_mutex {
38     //! Deny assignment and copy construction 
39     null_rw_mutex( const null_rw_mutex& );   
40     void operator=( const null_rw_mutex& );   
41 public:   
42     //! Represents acquisition of a mutex.
43     class scoped_lock {   
44     public:   
45         scoped_lock() {}
46         scoped_lock( null_rw_mutex& , bool = true ) {}
47         ~scoped_lock() {}
48         void acquire( null_rw_mutex& , bool = true ) {}
49         bool upgrade_to_writer() { return true; }
50         bool downgrade_to_reader() { return true; }
51         bool try_acquire( null_rw_mutex& , bool = true ) { return true; }
52         void release() {}
53     };
54   
55     null_rw_mutex() {}
56     
57     // Mutex traits   
58     static const bool is_rw_mutex = true;   
59     static const bool is_recursive_mutex = true;
60     static const bool is_fair_mutex = true;
61 };  
62
63 }
64
65 #endif /* __TBB_null_rw_mutex_H */