aboutsummaryrefslogtreecommitdiff
path: root/pw_sys_io_stdio
diff options
context:
space:
mode:
authorKeir Mierle <keir@google.com>2020-11-06 14:04:00 -0800
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2020-11-07 01:17:28 +0000
commit6909f18e6b7a710743dce4b6fe8005a8c1cf6365 (patch)
tree0cb7609e431bfc8d7de23e46a6afe164a779f31c /pw_sys_io_stdio
parent878bd196fe858f85edbb1dd6a992998c37de343c (diff)
downloadpigweed-6909f18e6b7a710743dce4b6fe8005a8c1cf6365.tar.gz
pw_sys_io: Add TryReadByte(byte* dest) function
This adds a non-blocking version of ReadByte() that enables writing, for example, a superloop that combines custom processing simultaneously with byte input handling for the RPC subsystem. Change-Id: I9cb1e6ae8c944ca7cdff6d4bff101ac52e80b53a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23980 Reviewed-by: Armando Montanez <amontanez@google.com> Commit-Queue: Keir Mierle <keir@google.com>
Diffstat (limited to 'pw_sys_io_stdio')
-rw-r--r--pw_sys_io_stdio/sys_io.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/pw_sys_io_stdio/sys_io.cc b/pw_sys_io_stdio/sys_io.cc
index 04ab9b038..53c9d5ebc 100644
--- a/pw_sys_io_stdio/sys_io.cc
+++ b/pw_sys_io_stdio/sys_io.cc
@@ -31,6 +31,11 @@ Status ReadByte(std::byte* dest) {
return Status::Ok();
}
+Status TryReadByte(std::byte*) {
+ // TryReadByte() is not (yet) supported on hosts.
+ return Status::Unimplemented();
+}
+
Status WriteByte(std::byte b) {
if (std::putchar(static_cast<char>(b)) == EOF) {
return Status::Internal();