2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-09-29 18:53:19 +00:00
This commit is contained in:
2020-11-15 04:41:30 +03:00
parent 7eae6b47ce
commit 4c36f591da
14 changed files with 177 additions and 204 deletions

View File

@@ -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() {}
}

View File

@@ -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
}

View File

@@ -1,4 +1,4 @@
// library esyur;
// library esiur;
import 'IEventHandler.dart';