File: scoped_write_lock.h

package info (click to toggle)
meshlab 2020.09%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 45,124 kB
  • sloc: cpp: 400,238; ansic: 31,952; javascript: 1,578; sh: 387; yacc: 238; lex: 139; python: 86; makefile: 29
file content (35 lines) | stat: -rwxr-xr-x 500 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef MT_SCOPED_WRITE_LOCK_H
#define MT_SCOPED_WRITE_LOCK_H

#include "rw_lock.h"

namespace mt
{

class scoped_write_lock
{
	MT_PREVENT_COPY(scoped_write_lock)

	public:

		typedef scoped_write_lock this_type;
		typedef void             base_type;

		scoped_write_lock(rw_lock & rwl) : rw(rwl)
		{
			this->rw.lock_write();
		}

		~scoped_write_lock(void)
		{
			this->rw.unlock_write();
		}

	protected:

		rw_lock & rw;
};

}

#endif // MT_SCOPED_WRITE_LOCK_H