Ok now so here's a question for you:
I'm trying to find out how much of a problem it will be to traverse a directory hierarchy with opendir and readdir with multiple threads.
What I have gathered is this: that opendir is thread safe, readdir only on different streams.
So what I don't understand, and maybe one of you fellows can clarify, is this: can I have multiple streams open on a single directory? If, say, a function that is called by several threads opens a stream to a given directory with opendir, do several open streams now exist on that one directory?
fopen has the handy flockfile, but I can't find an alternative with opendir. Trying to avoid mutexes as much as possible, because I think they are the kind of thing a newb can overuse by simple ignorance of when they actually are necessary.
Thankee kindly.
I'm trying to find out how much of a problem it will be to traverse a directory hierarchy with opendir and readdir with multiple threads.
What I have gathered is this: that opendir is thread safe, readdir only on different streams.
So what I don't understand, and maybe one of you fellows can clarify, is this: can I have multiple streams open on a single directory? If, say, a function that is called by several threads opens a stream to a given directory with opendir, do several open streams now exist on that one directory?
fopen has the handy flockfile, but I can't find an alternative with opendir. Trying to avoid mutexes as much as possible, because I think they are the kind of thing a newb can overuse by simple ignorance of when they actually are necessary.
Thankee kindly.