use atomic decrement rather than cas in pthread_exit thread count
[musl] / src / stdio / __fmodeflags.c
2012-10-25 Rich Felkergreatly improve freopen behavior