Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readdir_r is deprecated #56

Open
mpartel opened this issue Jun 18, 2017 · 3 comments
Open

readdir_r is deprecated #56

mpartel opened this issue Jun 18, 2017 · 3 comments

Comments

@mpartel
Copy link
Owner

mpartel commented Jun 18, 2017

Turns out readdir_r was deprecated around a year ago: https://lwn.net/Articles/696474/

We can probably safely replace it with readdir, but should check documentation on OS X and FreeBSD to be sure. Switching away from it would help avoid problems like #54.

@tyll
Copy link
Contributor

tyll commented Nov 3, 2017

@mpartel
Copy link
Owner Author

mpartel commented Nov 3, 2017

Sorry, I was vague. The question is whether we can count on it being thread-safe. Neither of those man-pages seems mention that.

I can easily imagine a thread-safe implementation and don't know why any non-ancient implementation wouldn't be thread-safe, but it'd be nice to know for sure.

@Doralitze
Copy link

readdir is thread-safe if and only if the directory stream, on which it is called is unique to the thread. If however the directory stream is shared among multiple threads, which are simultaneously accessing readdir, bad things may happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants