Update to zig 0.16.0, update deps, Vulkan validation fixes
This commit is contained in:
@@ -36,9 +36,9 @@ pub const Atom = enum(u16) {
|
||||
/// Turn a string into an atom. Returns either an existing atom or makes a
|
||||
/// new one, if necessary. This will always produce a valid atom. Will not
|
||||
/// return any error if the atom already exists.
|
||||
pub fn fromString(string: []const u8) error{ OutOfMemory, OutOfAtoms }!Atom {
|
||||
mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn fromString(string: []const u8, io: std.Io) error{ Canceled, OutOfMemory, OutOfAtoms }!Atom {
|
||||
try mutex.lock(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.debug.assert(initialized);
|
||||
|
||||
@@ -66,9 +66,9 @@ pub const Atom = enum(u16) {
|
||||
/// Turn a string into an atom, if the string has been already registered as
|
||||
/// an atom. Returns `null` otherwise. This will always produce a valid
|
||||
/// atom.
|
||||
pub fn fromStringIfExists(string: []const u8) ?Atom {
|
||||
mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn fromStringIfExists(string: []const u8, io: std.Io) error{Canceled}!?Atom {
|
||||
try mutex.lock(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.debug.assert(initialized);
|
||||
|
||||
@@ -81,9 +81,9 @@ pub const Atom = enum(u16) {
|
||||
}
|
||||
|
||||
/// Cast an atom into a string. The caller asserts that the atom is valid.
|
||||
pub fn toString(self: Atom) [:0]const u8 {
|
||||
try mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn toString(self: Atom, io: std.Io) error{Canceled}![:0]const u8 {
|
||||
try mutex.lock(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.debug.assert(initialized);
|
||||
|
||||
@@ -110,11 +110,11 @@ var map: std.StringHashMapUnmanaged(Atom) = undefined;
|
||||
var array: std.ArrayList([:0]const u8) = undefined;
|
||||
|
||||
/// Protects all reads and writes to `map` and `array`.
|
||||
var mutex: std.Thread.Mutex = .{};
|
||||
var mutex: std.Io.Mutex = .init;
|
||||
|
||||
pub fn init(_allocator: std.mem.Allocator) !void {
|
||||
mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn init(_allocator: std.mem.Allocator, io: std.Io) !void {
|
||||
try mutex.lock(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.debug.assert(!initialized);
|
||||
|
||||
@@ -129,9 +129,9 @@ pub fn init(_allocator: std.mem.Allocator) !void {
|
||||
try array.append(allocator, "");
|
||||
}
|
||||
|
||||
pub fn deinit() void {
|
||||
mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn deinit(io: std.Io) void {
|
||||
mutex.lockUncancelable(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.log.scoped(.deinit).debug("Deinitializing atoms", .{});
|
||||
std.debug.assert(initialized);
|
||||
@@ -149,9 +149,9 @@ pub fn deinit() void {
|
||||
|
||||
/// Dump all atoms in a readable format. Use for debugging. Does not flush the
|
||||
/// writer.
|
||||
pub fn dump(writer: std.Io.Writer) !void {
|
||||
mutex.lock();
|
||||
defer mutex.unlock();
|
||||
pub fn dump(writer: std.Io.Writer, io: std.Io) void {
|
||||
mutex.lockUncancelable(io);
|
||||
defer mutex.unlock(io);
|
||||
|
||||
std.debug.assert(initialized);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user