| 1 |
/* |
|---|
| 2 |
* ActionScript Thread Library |
|---|
| 3 |
* |
|---|
| 4 |
* Licensed under the MIT License |
|---|
| 5 |
* |
|---|
| 6 |
* Copyright (c) 2008 BeInteractive! (www.be-interactive.org) and |
|---|
| 7 |
* Spark project (www.libspark.org) |
|---|
| 8 |
* |
|---|
| 9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 10 |
* of this software and associated documentation files (the "Software"), to deal |
|---|
| 11 |
* in the Software without restriction, including without limitation the rights |
|---|
| 12 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 13 |
* copies of the Software, and to permit persons to whom the Software is |
|---|
| 14 |
* furnished to do so, subject to the following conditions: |
|---|
| 15 |
* |
|---|
| 16 |
* The above copyright notice and this permission notice shall be included in |
|---|
| 17 |
* all copies or substantial portions of the Software. |
|---|
| 18 |
* |
|---|
| 19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 24 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 25 |
* THE SOFTWARE. |
|---|
| 26 |
* |
|---|
| 27 |
*/ |
|---|
| 28 |
package org.libspark.thread |
|---|
| 29 |
{ |
|---|
| 30 |
/** |
|---|
| 31 |
* IMonitor インターフェイスは、スレッドのモニタ機構に関するメソッドを提供します. |
|---|
| 32 |
* |
|---|
| 33 |
* <p>モニタ機構は、スレッドを協調動作させるために使用します。たとえば、あるリソースが利用可能になるまで、 |
|---|
| 34 |
* そのリソースを利用する必要があるスレッドを待機させる、といったことが出来ます。</p> |
|---|
| 35 |
* |
|---|
| 36 |
* @author yossy:beinteractive |
|---|
| 37 |
*/ |
|---|
| 38 |
public interface IMonitor |
|---|
| 39 |
{ |
|---|
| 40 |
/** |
|---|
| 41 |
* 別のスレッドがこのモニターの notify メソッドまたは notifyAll メソッドを呼び出すか、指定された時間が経過するまで、現在のスレッドを待機させます. |
|---|
| 42 |
* |
|---|
| 43 |
* @param timeout 待機させる時間 (ミリ秒)。 0 を指定した場合、永遠に待ち続けます |
|---|
| 44 |
* @see #notify() |
|---|
| 45 |
* @see #notifyAll() |
|---|
| 46 |
*/ |
|---|
| 47 |
function wait(timeout:uint = 0):void; |
|---|
| 48 |
|
|---|
| 49 |
/** |
|---|
| 50 |
* このモニターで待機中のスレッドを 1 つ再開します. |
|---|
| 51 |
* |
|---|
| 52 |
* @see #wait() |
|---|
| 53 |
*/ |
|---|
| 54 |
function notify():void; |
|---|
| 55 |
|
|---|
| 56 |
/** |
|---|
| 57 |
* このモニターで待機中のすべてのスレッドを再開します. |
|---|
| 58 |
* |
|---|
| 59 |
* @see #wait() |
|---|
| 60 |
*/ |
|---|
| 61 |
function notifyAll():void; |
|---|
| 62 |
|
|---|
| 63 |
/** |
|---|
| 64 |
* 待機中に例外が発生した等の理由で、指定されたスレッドがこのモニタの待機セットから抜けることを伝えます. |
|---|
| 65 |
* |
|---|
| 66 |
* <p>通常、このメソッドは内部的にのみ使用され、ユーザーが呼び出す必要はありません。</p> |
|---|
| 67 |
* |
|---|
| 68 |
* @param thread 待機セットから抜けるスレッド |
|---|
| 69 |
*/ |
|---|
| 70 |
function leave(thread:Thread):void; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|