In practice, you're correct. In theory, however, consider the
following code
path.
THREAD 1 THREAD 2
------------------------------ ------------------------------
DIR *d1 = opendir(dir1);
DIR *d2 = opendir(dir2);
dent1 = readdir(dir1);
dent2 = readdir(dir2);
use(dent1);
In most implementations, dent1 != dent2. HOWEVER, there is no
guarantee that
they will not both point to the same statically allocated buffer, and
some
implementations may do so. For example, this is why ctime_r exists:
ctime
returns a pointer to a statically allocated buffer, and hence is not
thread
safe.