mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-09-29 18:53:19 +00:00
1.2.4
This commit is contained in:
@@ -1,52 +1,42 @@
|
||||
library esyur;
|
||||
library esiur;
|
||||
|
||||
import 'AsyncReply.dart';
|
||||
|
||||
class AsyncQueue<T> extends AsyncReply<T>
|
||||
{
|
||||
List<AsyncReply<T>> _list = new List<AsyncReply<T>>();
|
||||
class AsyncQueue<T> extends AsyncReply<T> {
|
||||
List<AsyncReply<T>> _list = new List<AsyncReply<T>>();
|
||||
|
||||
// object queueLock = new object();
|
||||
|
||||
add(AsyncReply<T> reply)
|
||||
{
|
||||
//lock (queueLock)
|
||||
_list.add(reply);
|
||||
|
||||
//super._resultReady = false;
|
||||
super.setResultReady(false);
|
||||
add(AsyncReply<T> reply) {
|
||||
//lock (queueLock)
|
||||
_list.add(reply);
|
||||
|
||||
reply.then(processQueue);
|
||||
}
|
||||
//super._resultReady = false;
|
||||
super.setResultReady(false);
|
||||
|
||||
remove(AsyncReply<T> reply)
|
||||
{
|
||||
//lock (queueLock)
|
||||
_list.remove(reply);
|
||||
processQueue(null);
|
||||
}
|
||||
|
||||
void processQueue(T o)
|
||||
{
|
||||
//lock (queueLock)
|
||||
for (var i = 0; i < _list.length; i++)
|
||||
if (_list[i].ready)
|
||||
{
|
||||
super.trigger(_list[i].result);
|
||||
super.ready = false;
|
||||
_list.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
|
||||
//super._resultReady = (_list.length == 0);
|
||||
super.setResultReady(_list.length == 0);
|
||||
}
|
||||
|
||||
AsyncQueue()
|
||||
{
|
||||
|
||||
}
|
||||
reply.then(processQueue);
|
||||
}
|
||||
|
||||
remove(AsyncReply<T> reply) {
|
||||
//lock (queueLock)
|
||||
_list.remove(reply);
|
||||
processQueue(null);
|
||||
}
|
||||
|
||||
void processQueue(T o) {
|
||||
//lock (queueLock)
|
||||
for (var i = 0; i < _list.length; i++)
|
||||
if (_list[i].ready) {
|
||||
super.trigger(_list[i].result);
|
||||
super.ready = false;
|
||||
_list.removeAt(i);
|
||||
i--;
|
||||
} else
|
||||
break;
|
||||
|
||||
//super._resultReady = (_list.length == 0);
|
||||
super.setResultReady(_list.length == 0);
|
||||
}
|
||||
|
||||
AsyncQueue() {}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ enum ExceptionCode
|
||||
{
|
||||
HostNotReachable,
|
||||
AccessDenied,
|
||||
UserNotFound,
|
||||
UserOrTokenNotFound,
|
||||
ChallengeFailed,
|
||||
ResourceNotFound,
|
||||
AttachDenied,
|
||||
@@ -29,5 +29,6 @@ enum ExceptionCode
|
||||
MethodNotFound,
|
||||
PropertyNotFound,
|
||||
SetPropertyDenied,
|
||||
ReadOnlyProperty
|
||||
ReadOnlyProperty,
|
||||
GeneralFailure
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
// library esyur;
|
||||
// library esiur;
|
||||
|
||||
import 'IEventHandler.dart';
|
||||
|
||||
|
Reference in New Issue
Block a user