2015-02-07 22:35:54 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-01-19 02:59:56 -08:00
|
|
|
#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WINXP_WIN_H_
|
|
|
|
|
#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WINXP_WIN_H_
|
2015-02-07 22:35:54 +00:00
|
|
|
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
|
2016-01-19 02:59:56 -08:00
|
|
|
#include "webrtc/system_wrappers/source/condition_variable_event_win.h"
|
2015-02-07 22:35:54 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-01-19 02:59:56 -08:00
|
|
|
class RWLockWinXP : public RWLockWrapper {
|
2015-02-07 22:35:54 +00:00
|
|
|
public:
|
2016-01-19 02:59:56 -08:00
|
|
|
RWLockWinXP();
|
|
|
|
|
~RWLockWinXP() override;
|
2015-02-07 22:35:54 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
void AcquireLockExclusive() override;
|
|
|
|
|
void ReleaseLockExclusive() override;
|
2015-02-07 22:35:54 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
void AcquireLockShared() override;
|
|
|
|
|
void ReleaseLockShared() override;
|
2015-02-07 22:35:54 +00:00
|
|
|
|
|
|
|
|
private:
|
2016-01-20 13:36:31 +01:00
|
|
|
CRITICAL_SECTION critical_section_;
|
2016-01-19 02:59:56 -08:00
|
|
|
ConditionVariableEventWin read_condition_;
|
|
|
|
|
ConditionVariableEventWin write_condition_;
|
|
|
|
|
|
|
|
|
|
int readers_active_ = 0;
|
|
|
|
|
bool writer_active_ = false;
|
|
|
|
|
int readers_waiting_ = 0;
|
|
|
|
|
int writers_waiting_ = 0;
|
2015-02-07 22:35:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-01-19 02:59:56 -08:00
|
|
|
#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WINXP_WIN_H_
|