Page 1 of 1

sdGetWouldBlock and sdPutWouldBlock invalid

Posted: Thu Feb 03, 2011 12:53 am
by brian360
Hi,

In the process of porting my project to ChibiOS 2.2.0, it looks like the sdGetWouldBlock and sdPutWouldBlock macro's haven't been updated to the new names for chIQIsEmptyI and chOQIsFullI.

Since they are now I-class APIs, does that mean I should wrap my sdGet/PutWouldBlock calls in lock zones? If so, then perhaps the sd macros should be renamed also.

I think Ian had reported this already, but I noticed they haven't been changed yet in trunk, so thought I'd post in a separate thread.

Thanks!

Re: sdGetWouldBlock and sdPutWouldBlock invalid

Posted: Thu Feb 03, 2011 9:21 am
by Giovanni
Thanks for reporting, I must have forgot this.

Anyway, probably those wouldblock functions probably should be deprecated because it is not possible to atomically check for the channel status and then read/write, there are no I-class get/put/read/write.

I think the best way to check the channel status is to use get/put with timeout specification TIME_IMMEDIATE, that makes the test+I/O atomic.

Giovanni