What can cause fwrite to hang?
My code is hanging fwrite with the following stack:
libc.so.6.1::___lll_lock_wait
libc.so.6.1::fwrite
This seems to be happening in solaris.
Only incorrect thing which I can think of is that my code may try to do a parallel fclose on the same FILE pointer which is used for doing fwrite. If a parallel fclose 开发者_Go百科happens will it lead to this kind of a stack?
But, I am not sure if the parallel fclose call really did happen or not?
What could be the problem here?
Looks like something has blown up somewhere. Operations on FILE* normally uses an internal lock to be thread safe. You've likely done something to invoke undefned behavior somewhere. E.g. you've corrupted the heap, overwriting something important(like a FILE), or the FILE* has been closed - in which case you can't rely on anything sane to happen if you continue to use it.
精彩评论