[En-Nut-Discussion] rs232d: closing socket while other thread is write blocked on socket

Henrik Maier hmnews at proconx.com
Sun Nov 29 04:46:22 CET 2009


It came to my attention that the rs232d.c demo actually closes the socket
while the other thread could still be write blocked on it. In that scenario
the socket is destroyed while being used.

For example Receiver() is blocked in the fwrite() call while main()  returns
from StreamCopy() due to connection break down and calls fclose(). 

Shouldn't in such a use case fwrite and fclose be synchronised by mutexes?

Henrik





More information about the En-Nut-Discussion mailing list