sdGetWouldBlock and sdPutWouldBlock invalid

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
brian360
Posts: 27
Joined: Wed Dec 08, 2010 5:47 pm

sdGetWouldBlock and sdPutWouldBlock invalid

Post 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!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: sdGetWouldBlock and sdPutWouldBlock invalid

Post 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
Post Reply