replaced all references of std.time.sleep with std.Thread.sleep

This commit is contained in:
peterino2 2025-10-13 17:56:07 -07:00
parent 179bbf0eef
commit 83537ef84f
9 changed files with 14 additions and 14 deletions

View File

@ -185,7 +185,7 @@ pub const JobWorker = struct {
// if (self.currentJobContext != null) { // if (self.currentJobContext != null) {
// break; // break;
// } // }
// std.time.sleep(1000 * 1000); // std.Thread.sleep(1000 * 1000);
//} //}
wakeGrabCount = 1; wakeGrabCount = 1;
} }

View File

@ -46,7 +46,7 @@ pub fn test_loadModules() !void {
_ = try core.loadModule("external", true); _ = try core.loadModule("external", true);
const moduleLoader = core.getEngineObject(core.ModuleLoader).?; const moduleLoader = core.getEngineObject(core.ModuleLoader).?;
std.time.sleep(1e9 * 0.1); std.Thread.sleep(1e9 * 0.1);
moduleLoader.tick(0.1); moduleLoader.tick(0.1);
} }

View File

@ -96,7 +96,7 @@ pub const SubprocessTask = struct {
pub fn wait(self: *@This()) void { pub fn wait(self: *@This()) void {
var completed: bool = self.completed; var completed: bool = self.completed;
while (completed == false) { while (completed == false) {
std.time.sleep(1 * 1000 * 1000); std.Thread.sleep(1 * 1000 * 1000);
self.mutex.lock(); self.mutex.lock();
completed = self.completed; completed = self.completed;
self.mutex.unlock(); self.mutex.unlock();

4
lib/nfd/src/nfd.zig vendored
View File

@ -154,7 +154,7 @@ pub const NFDRuntime = struct {
} }
fn blockUntilComplete(self: *@This()) void { fn blockUntilComplete(self: *@This()) void {
std.time.sleep(1000 * 1000); std.Thread.sleep(1000 * 1000);
var spinning: bool = true; var spinning: bool = true;
while (spinning) { while (spinning) {
@ -162,7 +162,7 @@ pub const NFDRuntime = struct {
if (self.runtimeState == .none) { if (self.runtimeState == .none) {
spinning = false; spinning = false;
} }
std.time.sleep(1000 * 1000); std.Thread.sleep(1000 * 1000);
self.lock.unlock(); self.lock.unlock();
} }
} }

View File

@ -213,7 +213,7 @@ test "concurrent queue multiple producer single consumer" {
}) catch unreachable; }) catch unreachable;
pushedCount += 1; pushedCount += 1;
std.time.sleep(1000 * 1000 * 100); std.Thread.sleep(1000 * 1000 * 100);
} }
_ = pushedCountResults.fetchAdd(pushedCount, .acq_rel); _ = pushedCountResults.fetchAdd(pushedCount, .acq_rel);
@ -259,7 +259,7 @@ test "concurrent queue multiple producer single consumer" {
std.debug.print("popped: {d}\t time left = {d:2.3}\t queueCount = {d} \r", .{ poppedCount, timeLeft, testQueue.count() }); std.debug.print("popped: {d}\t time left = {d:2.3}\t queueCount = {d} \r", .{ poppedCount, timeLeft, testQueue.count() });
} }
} }
std.time.sleep(1000 * 1000); std.Thread.sleep(1000 * 1000);
} }
for (0..threadCount) |i| { for (0..threadCount) |i| {

View File

@ -132,11 +132,11 @@ test "packer file watch" {
try fs.addFileChangedCallback("test2.txt", fileChangedCb, null); try fs.addFileChangedCallback("test2.txt", fileChangedCb, null);
var file = try std.fs.cwd().createFile("test_output/test2.txt", .{}); var file = try std.fs.cwd().createFile("test_output/test2.txt", .{});
std.time.sleep(100000000); std.Thread.sleep(100000000);
std.debug.print("writing to file\n", .{}); std.debug.print("writing to file\n", .{});
// var file = try std.fs.cwd().openFile("test_output/test2.txt", .{ .mode = .read_write }); // var file = try std.fs.cwd().openFile("test_output/test2.txt", .{ .mode = .read_write });
try file.writeAll("what the fuck bro"); try file.writeAll("what the fuck bro");
std.time.sleep(400000000); std.Thread.sleep(400000000);
// std.time.sleep(5000000000); // std.Thread.sleep(5000000000);
} }

View File

@ -16,7 +16,7 @@ pub fn prepare(self: *@This()) !void {
} }
pub fn tick(self: *@This(), dt: f64) void { pub fn tick(self: *@This(), dt: f64) void {
// std.time.sleep(1000_000); // std.Thread.sleep(1000_000);
self.timeLeft -= dt; self.timeLeft -= dt;
if (self.timeLeft < 0) if (self.timeLeft < 0)
@ -98,7 +98,7 @@ const MultiJob = struct {
pub fn tick(ctx: @This()) !void { pub fn tick(ctx: @This()) !void {
const z = core.tracy.ZoneN(@src(), "MultiJob Tick"); const z = core.tracy.ZoneN(@src(), "MultiJob Tick");
defer z.End(); defer z.End();
// std.time.sleep(100_000 * ctx.threadId); // std.Thread.sleep(100_000 * ctx.threadId);
try Barrier(@src()).sync(ctx.threadId); try Barrier(@src()).sync(ctx.threadId);
} }

View File

@ -41,7 +41,7 @@ pub fn prepare(self: *@This()) !void {
pub fn tick(self: *@This(), dt: f64) void { pub fn tick(self: *@This(), dt: f64) void {
_ = dt; _ = dt;
std.time.sleep(10 * 1000 * 1000); std.Thread.sleep(10 * 1000 * 1000);
self.tickTasks() catch {}; self.tickTasks() catch {};
self.animationStore.tick(); self.animationStore.tick();

View File

@ -135,7 +135,7 @@ pub fn prepare(self: *@This()) !void {
} }
pub fn tick(self: *@This(), _: f64) void { pub fn tick(self: *@This(), _: f64) void {
std.time.sleep(10_000_000); std.Thread.sleep(10_000_000);
var successCount: u32 = 0; var successCount: u32 = 0;
if (self.testResultsQueue.count() == self.modules.items.len) { if (self.testResultsQueue.count() == self.modules.items.len) {