unknowcoder wrote on Wednesday, August 15, 2018:
Hi,
I want to use the xStreamBufferReceive() but pass in a buffer of length 0. Is this valid? I don’t want it to copy any data to the buffer location I just want it to return when the threshold has been meet, but I also want to keep the task in the block state for at least 100ms or until the threshold has been meet.
I have a special case where the thread that consume the streambuffer need to wake up every 100ms or sooner if data is in the stream buffer. The thread does many other things beside service this stream buffer. That why only a timeout of 100ms is used. The thread is only event driven depending on if the stream buffer has meet it’s threshold, if not it’s safe to wait for 100ms to keep the CPU unloaded.
I can’t copy the data into the stream buffer at that time because I won’t have enough memory to copy the data. Thus I just need the task to wake up if the stream buffer has meet it’s threshold or has timeouted. Later on in the state machine I would have enough RAM at which point I will copy out the data, by calling xStreamBufferReceive() again without a blocking time.
Question:
1) Is it valid to call xStreamBufferReceive() with buffer length of 0?
2) If a buffer length of zero is used will the stream buffer still block until the threshold or timeout is meet?