activemq-cpp-3.6.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
AbstractQueuedSynchronizer.h
Go to the documentation of this file.
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef _DECAF_UTIL_CONCURRENT_LOCKS_ABSTRACTQUEUEDSYNCHRONIZER_H_
19
#define _DECAF_UTIL_CONCURRENT_LOCKS_ABSTRACTQUEUEDSYNCHRONIZER_H_
20
21
#include <
decaf/util/Config.h
>
22
23
#include <
decaf/util/concurrent/locks/AbstractOwnableSynchronizer.h
>
24
#include <
decaf/util/concurrent/locks/Condition.h
>
25
#include <
decaf/util/Collection.h
>
26
#include <
decaf/lang/Thread.h
>
27
28
namespace
decaf {
29
namespace
util {
30
namespace
concurrent {
31
namespace
locks {
32
33
class
SynchronizerState;
34
35
class
DECAF_API
AbstractQueuedSynchronizer
:
public
AbstractOwnableSynchronizer
{
36
private
:
37
38
SynchronizerState* impl;
39
40
private
:
41
42
AbstractQueuedSynchronizer
(
const
AbstractQueuedSynchronizer
&);
43
AbstractQueuedSynchronizer
& operator= (
const
AbstractQueuedSynchronizer
&);
44
45
protected
:
46
47
AbstractQueuedSynchronizer
();
48
49
public
:
50
55
class
ConditionObject
:
public
Condition
{
56
private
:
57
58
friend
class
AbstractQueuedSynchronizer
;
59
60
private
:
61
62
ConditionObject
(
const
ConditionObject
&);
63
ConditionObject
& operator= (
const
ConditionObject
&);
64
65
public
:
66
67
ConditionObject
() :
Condition
() {}
68
virtual
~ConditionObject
() {}
69
70
protected
:
71
77
virtual
bool
isOwnedBy(
const
AbstractQueuedSynchronizer
* sync)
const
= 0;
78
85
virtual
bool
hasWaiters()
const
= 0;
86
93
virtual
int
getWaitQueueLength()
const
= 0;
94
101
virtual
Collection<decaf::lang::Thread*>
* getWaitingThreads()
const
= 0;
102
};
103
104
public
:
105
106
virtual
~
AbstractQueuedSynchronizer
();
107
116
void
acquire(
int
arg);
117
126
void
acquireShared(
int
arg);
127
139
void
acquireInterruptibly(
int
arg);
140
151
void
acquireSharedInterruptibly(
int
arg);
152
160
Collection<decaf::lang::Thread*>
* getExclusiveQueuedThreads()
const
;
161
169
Collection<decaf::lang::Thread*>
* getSharedQueuedThreads()
const
;
170
177
decaf::lang::Thread
* getFirstQueuedThread()
const
;
178
186
Collection<decaf::lang::Thread*>
* getQueuedThreads()
const
;
187
195
int
getQueueLength()
const
;
196
208
Collection<decaf::lang::Thread*>
* getWaitingThreads(
const
AbstractQueuedSynchronizer::ConditionObject
* condition)
const
;
209
222
int
getWaitQueueLength(
const
AbstractQueuedSynchronizer::ConditionObject
* condition)
const
;
223
227
bool
hasContended()
const
;
228
232
bool
hasQueuedThreads()
const
;
233
244
bool
hasWaiters(
const
AbstractQueuedSynchronizer::ConditionObject
* condition)
const
;
245
253
bool
isQueued(
decaf::lang::Thread
* thread)
const
;
254
262
bool
owns(
const
AbstractQueuedSynchronizer::ConditionObject
* condition)
const
;
263
274
bool
release(
int
arg);
275
286
bool
releaseShared(
int
arg);
287
296
std::string toString()
const
;
297
312
bool
tryAcquireNanos(
int
arg,
long
long
nanos);
313
328
bool
tryAcquireSharedNanos(
int
arg,
long
long
nanos);
329
330
protected
:
331
337
virtual
int
getState()
const
;
338
345
virtual
void
setState(
int
value);
346
358
virtual
bool
compareAndSetState(
int
expect,
int
update);
359
369
virtual
bool
isHeldExclusively()
const
;
370
390
virtual
bool
tryAcquire(
int
arg);
391
413
virtual
int
tryAcquireShared(
int
arg);
414
430
virtual
bool
tryRelease(
int
arg);
431
447
virtual
bool
tryReleaseShared(
int
arg);
448
456
virtual
ConditionObject* createDefaultConditionObject();
457
490
bool
hasQueuedPredecessors()
const
;
491
492
friend
class
SynchronizerState;
493
};
494
495
}}}}
496
497
#endif
/* _DECAF_UTIL_CONCURRENT_LOCKS_ABSTRACTQUEUEDSYNCHRONIZER_H_ */
src
main
decaf
util
concurrent
locks
AbstractQueuedSynchronizer.h
Generated on Mon Mar 4 2013 10:25:46 for activemq-cpp-3.6.0 by
1.8.1.2