From 846fea1c0fadd2b5517c1d15107e7dbe92fffb3c Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 1 Nov 2021 03:53:10 +0800 Subject: [PATCH] add a note on callback implementations --- API.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/API.md b/API.md index ebbd9ef2c..d14bf365b 100644 --- a/API.md +++ b/API.md @@ -150,6 +150,9 @@ impl MyServer { } /// an example of registering for a callback + /// Note: since Xous 0.9 we support `std` threads and closures. See the Net crate + /// for an example of how to implement callbacks using `std` primitives. + /// The below implementation is how closures are done in a `no-std` fashion. static mut MYSERVER_CB: Option = None; // this actually goes outside the object decl pub fn hook_callback(&mut self, cb: fn(u32)) -> Result<(), xous::Error> { if unsafe{MYSERVER_CB}.is_some() {