Checking for data availability in a channel?

New to XMOS and XCore? Get started here.
Post Reply
Treczoks
Active Member
Posts: 38
Joined: Thu Mar 21, 2013 11:18 am
Contact:

Checking for data availability in a channel?

Post by Treczoks »

Hi!

I've got a chanend where data might come to. Might. So I could use something like this:

Code: Select all

select {
  case MyChan :> Data:
    DataReceived = 1;
    break;
  default:
    DataReceived = 0;
    break;
}
This strikes me as being a bit bulky - is there no simple way just to ask a chanend if there is something available?

Yours, Christian Treczoks


User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

This would be the recommended way.
Post Reply