Changeset 101:58014b95afb5
- Timestamp:
- 02/09/08 15:29:43
(10 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Implemented RunnableLock?. Thanks torhu for the testcase.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r57 |
r101 |
|
| 16 | 16 | import dwt.dwthelper.Runnable; |
|---|
| 17 | 17 | import tango.core.Exception; |
|---|
| | 18 | import tango.core.sync.Condition; |
|---|
| | 19 | import tango.core.sync.Mutex; |
|---|
| 18 | 20 | |
|---|
| 19 | 21 | /** |
|---|
| … | … | |
| 24 | 26 | */ |
|---|
| 25 | 27 | |
|---|
| 26 | | class RunnableLock { |
|---|
| | 28 | class RunnableLock : Mutex { |
|---|
| 27 | 29 | Runnable runnable; |
|---|
| 28 | 30 | Thread thread; |
|---|
| 29 | 31 | Exception throwable; |
|---|
| | 32 | Condition cond; |
|---|
| 30 | 33 | |
|---|
| 31 | 34 | this (Runnable runnable) { |
|---|
| 32 | 35 | this.runnable = runnable; |
|---|
| | 36 | this.cond = new Condition(this); |
|---|
| 33 | 37 | } |
|---|
| 34 | 38 | |
|---|
| … | … | |
| 42 | 46 | } |
|---|
| 43 | 47 | |
|---|
| 44 | | //PORTING_FIXME: How to emulate Java locking? |
|---|
| 45 | 48 | void notifyAll(){ |
|---|
| | 49 | cond.notifyAll(); |
|---|
| 46 | 50 | } |
|---|
| 47 | | //PORTING_FIXME: How to emulate Java locking? |
|---|
| 48 | 51 | void wait(){ |
|---|
| | 52 | cond.wait(); |
|---|
| 49 | 53 | } |
|---|
| 50 | 54 | |
|---|