You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by Frederic Fortier <no...@github.com> on 2020/05/27 01:23:50 UTC

[apache/incubator-teaclave-sgx-sdk] Channel sender from ocall (#241)

Is it possible to use ocall with async channels (like in this pseudo code)?
```rust
fn subscribe() {
  let (mut tx, mut rx) = mpsc::unbounded::<usize>();
  // I know that I can't declare an ocall inside a fn
  // I want to illustrate of accessing the Receiver in the ocall
  fn ocall_pick_number(out_number: usize) {
    tx.send(out_number).unwrap();
  }
}
```
Is there a way to declare ocalls in the trusted module such that an arbitrary Receiver can be available in context? Or should send my trusted module a raw pointer to the Receiver instance that can be sent back as an argument of each ocall? 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/241

Re: [apache/incubator-teaclave-sgx-sdk] Channel sender from ocall (#241)

Posted by Frederic Fortier <no...@github.com>.
Got this working using `lazy_static` to inject a synchronizable object into my ocall.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/241#issuecomment-635147568

Re: [apache/incubator-teaclave-sgx-sdk] Channel sender from ocall (#241)

Posted by Frederic Fortier <no...@github.com>.
Closed #241.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/241#event-3381359899