Merge bfee652a94
into 4bee62e4e2
This commit is contained in:
commit
e234bd3daf
|
@ -0,0 +1,12 @@
|
|||
module tristanable.queue.listener;
|
||||
|
||||
// TODO: Implement me
|
||||
|
||||
import tristanable.queue;
|
||||
import tristanable.encoding;
|
||||
|
||||
public interface TListener
|
||||
{
|
||||
// TODO: See if this is all we need / what we want
|
||||
public void onQueueReceive(Queue queue, TaggedMessage message);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Queue type and related facilities
|
||||
*/
|
||||
module tristanable.queue;
|
||||
|
||||
|
||||
/**
|
||||
* The Queue type for enqueueing and dequeueing messages
|
||||
*/
|
||||
public import tristanable.queue.queue : Queue;
|
||||
|
||||
/**
|
||||
* Interface type for definining listeners which can be hooked
|
||||
* to queue actions
|
||||
*/
|
||||
public import tristanable.queue.listener : TListener;
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
module tristanable.queue.queue;
|
||||
|
||||
import tristanable.queue.listener : TListener;
|
||||
|
||||
import core.sync.mutex : Mutex;
|
||||
import core.sync.condition : Condition;
|
||||
import core.sync.exception : SyncError;
|
||||
|
@ -52,6 +54,18 @@ public class Queue
|
|||
*/
|
||||
private Mutex queueLock;
|
||||
|
||||
/**
|
||||
* Attached queue listeners
|
||||
*/
|
||||
private SList!(TListener) listeners;
|
||||
|
||||
/**
|
||||
* Lock for the listeners queue
|
||||
*/
|
||||
private Mutex listenersLock;
|
||||
|
||||
// TODO: Add listener add/remove methods
|
||||
// TODO: On queue actions add a notificaiton call to the listeners
|
||||
/**
|
||||
* If a message is enqueued prior
|
||||
* to us sleeping then we won't
|
||||
|
|
Loading…
Reference in New Issue