reentrancy and fclose.c
Joel Sherrill
joel@OARcorp.com
Tue May 19 12:11:00 GMT 1998
Hi,
One of the RTEMS users was looking at fclose and is concerned about the
possibility of multiple tasks attempting to close the same FILE
simultaneously. In his scenario, task A blocks while doing the fflush()
and task B begins to execute fclose() on the same FILE.
If newlib's reentrancy features are in use (which they are in this case),
will this be safe? If so, why?
We see one of the tasks returning from fflush() first and freeing all the
memory. The second task gets stale pointers and tries to free those
buffers. We suppose that the worst case would be that the buffers get
reallocated before the second task gets its shot at freeing them.
Comments...
--joel
Joel Sherrill Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (205) 722-9985
More information about the Newlib
mailing list