SynchronizedAccessor.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
18 package com.generalrobotix.ui.util;
19 import java.util.concurrent.TimeUnit;
20 import java.util.concurrent.locks.Condition;
21 import java.util.concurrent.locks.ReentrantLock;
22 import java.util.concurrent.locks.Lock;
23 
24 public class SynchronizedAccessor < T extends java.lang.Object >
25  implements Lock
26 {
27  private T value_ = null;
28  private ReentrantLock reentrantLock_ = new ReentrantLock();
29 
31  value_ = val;
32  }
33 
34  public synchronized T get(){ return value_; }
35  public synchronized void set(T val){ value_ = val; }
36 
37  public void lock()
38  {
39  // TODO 自動生成されたメソッド・スタブ
40  reentrantLock_.lock();
41  }
42 
43  public void lockInterruptibly()
44  throws InterruptedException
45  {
46  // TODO 自動生成されたメソッド・スタブ
47  reentrantLock_.lockInterruptibly();
48  }
49 
51  {
52  // TODO 自動生成されたメソッド・スタブ
53  return reentrantLock_.newCondition();
54  }
55 
56  public boolean tryLock()
57  {
58  // TODO 自動生成されたメソッド・スタブ
59  return reentrantLock_.tryLock();
60  }
61 
62  public boolean tryLock(long time, TimeUnit unit)
63  throws InterruptedException
64  {
65  // TODO 自動生成されたメソッド・スタブ
66  return reentrantLock_.tryLock(time, unit);
67  }
68 
69  public void unlock()
70  {
71  // TODO 自動生成されたメソッド・スタブ
72  reentrantLock_.unlock();
73  }
74 }
#define null
our own NULL pointer
Definition: IceTypes.h:57
png_infop int * unit
Definition: png.h:2451
int val
Definition: jpeglib.h:956


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05