-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread Safety #37
Comments
Are you trying to use the same socket from multiple threads? "Sockets and user threads protection
Please let me know if this answers your issue. |
No, the socket is opened and used by one thread only. I have a while loop that is writing a buffer (~4K) until all bytes have been sent. The TCPIP task preempts this task and seems to change the head/tail pointers while we are also trying to send more data. I've added a workaround to delay 5ms in the while loop between successive reads/writes of TCP which seems to avoid this race condition. |
It'd be helpful if you could identify the part of the code that overwrites those head/tail pointers. Also, would it be possible to send to me a simplified version of your code that exposes this behavior? |
I am having an issue where the TCPIP task is overwriting other tasks stacks. The function
static uint16_t _TCPSocketTxFreeSize(TCB_STUB* pSkt)
is returning a size of 0xFFFF due to the function getting preempted after the second if statement, but before it returns the calculated size. At the time of comparing the head to the tail, the head is less, after the if is skipped the head and tail are equal. Here is the function body:Is thought the library was thread-safe, is there something else I need to add? I've configured the library to use thread-safe malloc/free provided by FreeRTOS, as well as adding a thread-safe calloc.
The text was updated successfully, but these errors were encountered: