AnsweredAssumed Answered

Undocumented Behavior/Bug(?) traced to OSA_SemmaCreate

Question asked by Mike Sandlin on Sep 7, 2015
Latest reply on Sep 10, 2015 by Daniel Chen

I ran into a problem using nio_pipe_write. Writes appeared to be blocked by default. I finally traced the problem to OSA_SemmaCreate. The pipe initialization function takes a _mqx_uint argument, which is a uint32, to set pipe length. It uses this as the initial value to create a lwsemaphore that tracks the amount of data written into the pipe, and blocks writes when the pipe is full. The problem is that the nio_pipe_init routine uses the OSA, and the OSA_SemmaCreate function specifies uint8, for reasons unknown. I specified a pipe length of 256 bytes, which was truncated to zero by the OSA_SemmaCreate call. Therefore, pipe writes were blocked at pipe initialization.

 

For now, I can simply reduce my pipe length by one byte, but I anticipate the need for longer pipes further on. Are there repercussions I am not aware of if I simply modified the OSA_SemmaCreate function call to use a uint32 initial value?

 

Thanks for any responses.

Outcomes