chnWriteTimeout with USB Serial - finish on buffer write or device write?
Posted: Tue Jul 02, 2019 4:52 pm
Hello,
I have a few questions about using the Serial over USB Driver (SDU1 on STM32F072B).
If I may ask:
1. How thread safe is it?
a. Is it safe to have a writer thread (chnWriteTimeout) and a reader thread (chnReadTimeout) running at the same time?
b. Is it safe to have multiple writer threads doing chnWriteTimeout or will messages intermingle/corrupt?
2. Does the chnWrite/chnRead function return once the data in place into the appropriate buffer or does it wait until the data actually sent?
a. Would it be an acceptable pattern to have multiple threads do blocking writes or would this result in very long waits because it has to be sent over the wire before the functions returns?
3. How big is the efficiency difference of calling chnWriteTimeout vs repeated calls of chnPutTimeout?
Thanks!
I have a few questions about using the Serial over USB Driver (SDU1 on STM32F072B).
If I may ask:
1. How thread safe is it?
a. Is it safe to have a writer thread (chnWriteTimeout) and a reader thread (chnReadTimeout) running at the same time?
b. Is it safe to have multiple writer threads doing chnWriteTimeout or will messages intermingle/corrupt?
2. Does the chnWrite/chnRead function return once the data in place into the appropriate buffer or does it wait until the data actually sent?
a. Would it be an acceptable pattern to have multiple threads do blocking writes or would this result in very long waits because it has to be sent over the wire before the functions returns?
3. How big is the efficiency difference of calling chnWriteTimeout vs repeated calls of chnPutTimeout?
Thanks!