Pops a Request instance from the queue
Pops a Request instance from the queue
Push a new request on the queue
Type of the delegate used for notifications
Finds out whether the provided number of bytes will fit in the queue. Also considers the need of wrapping.
Tells whether the queue is empty.
register an handler as available
Check whether the provided notifier is already registered. This allows the code to avoid calling ready() with the same notifier, which may throw or add duplicate notifiers.
Push an item into the queue and notify the next waiting notification delegate about it.
Push an item into the queue and notify the next waiting handler about it.
suspend consuming of the queue
Returns true if the queue is suspended, else false
resume consuming of the queue
pops an element if the queue is enabled
type that the queue should store. If it's a struct it is stored using the struct serializer, else it is storing it directly. Note that by default the memory is not gc-aware so you reference something from only the stored object, the gc could collect it. If you desire different behavior pass your own queue instance to the constructor
NotifyingQueue with a non-struct type
auto queue = new NotifyingQueue!(char[])(1024); char[][] arr = ["foo".dup, "bar".dup]; queue.push(arr[0]); queue.push(arr[1]); void[] buffer_1; auto str_0 = queue.pop(buffer_1); test!("==")(*str_0, "foo"); void[] buffer_2; auto str_1 = queue.pop(buffer_2); test!("==")(*str_0, "foo"); // ensure there was no overwrite test!("==")(*str_1, "bar");
NotifyingQueue with a struct
struct S { char[] value; } S[2] arr = [S("foo".dup), S("bar".dup)]; auto queue = new NotifyingQueue!(S)(1024); queue.push(arr[0]); queue.push(arr[1]); Contiguous!(S) ctg_1; auto s0 = queue.pop(ctg_1); test!("==")(s0.value, "foo"); Contiguous!(S) ctg_2; auto s1 = queue.pop(ctg_2); test!("==")(s0.value, "foo"); // ensure there was no overwrite test!("==")(s1.value, "bar");
Templated Notifying Queue implementation
A concrete client should have an instance of this class and use it to manage the connections and requests
Note: the stored type T is automatically de/serialized using the StructSerializer. This performs a deep serialization of sub-structs and array members. Union members are shallowly serialized. Delegate and class members cannot be serialized.