saving
This commit is contained in:
parent
ffc84ce44c
commit
fc8165eb83
|
|
@ -14,13 +14,11 @@ pub const ConcurrentQueueError = error{
|
|||
QueueIsFull,
|
||||
};
|
||||
|
||||
pub fn ConcurrentQueueU(comptime T: type) type {
|
||||
return ConcurrentQueueUnmanagedAdvanced(T, .{});
|
||||
pub fn ConcurrentQueue(comptime T: type) type {
|
||||
return ConcurrentQueueAdvanced(T, .{});
|
||||
}
|
||||
|
||||
pub fn ConcurrentQueueAssert(comptime T: type) type {
|
||||
return ConcurrentQueueUnmanagedAdvanced(T, .{ .allowAsserts = true });
|
||||
}
|
||||
pub const ConcurrentQueueU = ConcurrentQueue;
|
||||
|
||||
// lock-free concurrent queue, fixed capacity,
|
||||
// will never resize.
|
||||
|
|
@ -33,7 +31,7 @@ pub const ConcurrentStatus = packed struct(usize) {
|
|||
generation: u63 = 0,
|
||||
};
|
||||
|
||||
pub fn ConcurrentQueueUnmanagedAdvanced(comptime T: type, comptime opts: struct {
|
||||
pub fn ConcurrentQueueAdvanced(comptime T: type, comptime opts: struct {
|
||||
allowAsserts: bool = false,
|
||||
debug: bool = false,
|
||||
}) type {
|
||||
|
|
@ -142,7 +140,7 @@ test "concurrent queue basic correctness test" {
|
|||
|
||||
const allocator = std.testing.allocator;
|
||||
|
||||
var y = try ConcurrentQueueUnmanagedAdvanced(Info, .{ .allowAsserts = true, .debug = true }).initCapacity(allocator, 420);
|
||||
var y = try ConcurrentQueueAdvanced(Info, .{ .allowAsserts = true, .debug = true }).initCapacity(allocator, 420);
|
||||
defer y.deinit(allocator);
|
||||
|
||||
try y.push(.{});
|
||||
|
|
@ -158,7 +156,7 @@ test "concurrent queue basic correctness test" {
|
|||
|
||||
try utils.assertf(y.count() == 0, "expected there to be {d} elements in queue, we saw {d}", .{ 0, y.count() });
|
||||
|
||||
var x = try ConcurrentQueueU(Info).initCapacity(allocator, 12);
|
||||
var x = try ConcurrentQueue(Info).initCapacity(allocator, 12);
|
||||
defer x.deinit(allocator);
|
||||
|
||||
try x.push(.{ .x = 0 });
|
||||
|
|
@ -189,7 +187,7 @@ test "concurrent queue multiple producer single consumer" {
|
|||
arb: [4096]u8 = undefined,
|
||||
};
|
||||
|
||||
const QueueType = ConcurrentQueueUnmanagedAdvanced(Payload, .{ .debug = false, .allowAsserts = true });
|
||||
const QueueType = ConcurrentQueueAdvanced(Payload, .{ .debug = false, .allowAsserts = true });
|
||||
|
||||
const Wrap = struct {
|
||||
pub fn threadFunc(queueRef: *QueueType, id: i64, exitSignal: *Atomic(bool), pushedCountResults: *Atomic(i64)) void {
|
||||
|
|
|
|||
Loading…
Reference in New Issue