Doing some testing with serial reads and trying to use std.io.poll and pollTimeout()
When creating std.io.poll with serial (like /dev/ttyACMx) and using the pollTimeout() on that the timeout newer timeouts… if there is data available on serialport pollTimeout() returns true if no data available it just blocks until data is available?
What I’m doing wrong?
some code here (not all…)
var poller = std.io.poll(std.heap.page_allocator, enum { serial }, .{
.serial = ctx.file, // <- this is File opened earlier
});
defer poller.deinit();
while (ctx.running.load(.acquire)) {
std.log.info("polling serial port", .{});
const ready = poller.pollTimeout(100) catch {
std.log.info("poll timeout", .{});
continue;
};
if (ready) { do some processing... }
};
This newer timeouts. Tried both Linux and MacOS