reentrant functions 질문..

herrcho의 이미지

advanced programming in the unix environment p.278

읽다가 궁금해서요,

Most implementations of the standard I/O library use global data

structures in a nonreentrant way.

이게 무슨 말인지 잘 모르겠네요

nonreentrant way 가 뭘뜻하는지, 그리고, global data structures 는

전역변수 그런 개념인가요? 도통 이해가 가질 않네요. :(

cinsk의 이미지

APIUE wrote:
Most implementations of the standard I/O library use global data structures in a nonreentrant way.

Standard I/O library가 thread-safe하지 않다는 말입니다. 즉 여러 thread에서 동시에 호출하면 위험하다는 뜻이죠. Library가 내부적으로 자신의 상태를 어딘가 (global variable, 또는 static local variable) 저장할 확율이 있어서 여러 thread에서 동시에 호출하게 되면 문제가 발생할 수 있다는 뜻입니다.