summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.h
blob: 9388710c92fda79ca9ce1d66aa40e0dc5af20d33 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/orbsvcs/Concurrency_Service
//
// = FILENAME
//      CC_LockSet.h
//
// = DESCRIPTION
//      This class implements the lock set interface from the
//      concurrency service
//
// = AUTHORS
//      Torben Worm <tworm@cs.wustl.edu>
//
// ============================================================================

#if !defined (_CC_LOCKSET_H)
#define _CC_LOCKSET_H

// #include "tao/corba.h"
#include "CC_Lock.h"
#include "orbsvcs/CosConcurrencyControlS.h"

class TAO_ORBSVCS_Export CC_LockSet :  public POA_CosConcurrencyControl::LockSet
  // = TITLE
  //     CC_LockSet
  //
  // = DESCRIPTION
  //     This class implements the LockSet interface that is part of
  //     the CosConcurrency service. Please consult the idl file for
  //     detailed descriptions apart from the comments in this file At
  //     present the lock set is not really a set, but only one lock.
{
public:
  // = Initialization and termination methods.
  CC_LockSet(void);
  // Default constructor
  
  CC_LockSet(CosConcurrencyControl::LockSet_ptr related);
  // Constructor used if create_related is used to create the lock
  // set.

  ~CC_LockSet(void);
  // Destructor.

  virtual void lock (CosConcurrencyControl::lock_mode mode,
		     CORBA::Environment &env);
  // Acquires this lock. Blocks until lock is obtained

  virtual CORBA::Boolean try_lock (CosConcurrencyControl::lock_mode mode,
				   CORBA::Environment &env);
  // Tries to acquire this lock. If it is not possible to acquire the
  // lock, false is returned

  virtual void unlock (CosConcurrencyControl::lock_mode mode,
		       CORBA::Environment &env);
  // Releases this lock.
  
  virtual void change_mode (CosConcurrencyControl::lock_mode held_mode,
			    CosConcurrencyControl::lock_mode new_mode,
			    CORBA::Environment &env);
  // Changes the mode of this lock.

private:
  CC_Lock *lock_;
  // At present the lock set contains only one lock.

  CosConcurrencyControl::LockSet_ptr related_lockset_;
  // If this lock set is related to another lock set, this is the
  // pointer to the related lock set. This is a really simple
  // solution, but since transactions are not supported in the first
  // version there should be no reason to drop lock sets together. The
  // LockSetCoordinator is not implemented (it has the
  // responsibilities of dropping the locks).
};

#endif /* _CC_LOCKSET_H */