qix 0.0.18-alpha
Simple waitable-queue management
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Qix
Simple waitable-queue management
Usage
A basic example of the usage is shown below. Please note that it is only for demonstration purposes. A much more sensible use case is to have one thread calling receive(Message)
to enqueue messages and then another thread blocking on wait(Duration)
to dequeue a message:
// item type
struct Message
{
private string _t;
this(string t)
{
this._t = t;
}
public string t()
{
return this._t;
}
}
// queue manager for queues that hold messages
auto m = new Manager!(Message);
// create two new queues
Result!(Queue!(Message)*, string) q1_r = m.newQueue();
Result!(Queue!(Message)*, string) q2_r = m.newQueue();
assert(q1_r.is_okay());
assert(q2_r.is_okay());
auto q1 = q1_r.ok();
auto q2 = q2_r.ok();
// enqueue two messages, one per queue, then read them off
//
// we won't block as the messages are already arrived
Message m1_in = Message("First message");
Message m2_in = Message("Second message");
assert(q1.receive(m1_in)); // should not be rejected
assert(q2.receive(m2_in)); // should not be rejected
assert(q1.wait() == m1_in); // should be the same message we sent in
assert(q2.wait() == m2_in); // should be the same message we sent in
A more sensible threaded example can be found here.
Docs
You can also take a look at the API documentation.
License
The license is the LGPL 2.0 only.
- 0.0.18-alpha released 7 days ago
- deavmi/qix
- LGPL-2.0-only
- Copyright © 2025, Tristan B. Velloza Kildaire
- Authors:
- Dependencies:
- gogga, niknaks
- Versions:
-
0.0.18-alpha 2025-Jun-23 0.0.17-alpha 2025-Jun-23 0.0.16-alpha 2025-Jun-23 0.0.15-alpha 2025-Jun-22 0.0.14-alpha 2025-Jun-18 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
3 downloads this month
-
4 downloads total
-
- Score:
- 0.5
- Short URL:
- qix.dub.pm