2 #include "scoped_rw_lock.h"
7 std::vector
<SRWLOCK
> scoped_rw_lock::_srws
;
9 void scoped_rw_lock::initialize()
11 _srws
.resize(LAST_MONITOR_LOCATION
);
12 for (int i
= 0; i
< LAST_MONITOR_LOCATION
; ++i
)
13 InitializeSRWLock(&_srws
[i
]);
16 scoped_rw_lock::scoped_rw_lock(MONITOR_LOCATION cs_location
, bool is_shared
)
18 _curr_srw
= &_srws
[cs_location
];
19 _is_shared
= is_shared
;
22 AcquireSRWLockShared(_curr_srw
);
24 AcquireSRWLockExclusive(_curr_srw
);
27 scoped_rw_lock::~scoped_rw_lock()
30 ReleaseSRWLockShared(_curr_srw
);
32 ReleaseSRWLockExclusive(_curr_srw
);