-
Notifications
You must be signed in to change notification settings - Fork 119
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
cwd not thread-safe #22
Comments
Hey. Thanks for bringing this up. Just wanted to let you know that I've seen this issue. I'll take a look within the next week or so. I've got a whole lot going on at the moment. Just a heads up so that you don't think I'm ignoring you if I don't respond for a couple of days. |
no hurries - I won't feel ignored - best wishes for your mom - fs. |
Hey. Sorry I haven't looked at this in so long. @amalloy Would you want this in useful? https://github.com/franks42/fs/blob/master/src/fs/utils.clj#L31 |
Thanks for picking this up again. Did you think about how to make fs more thread-safe ? There may be alternative ways to go about it besides my suggestion... Thanks, FrankS. On Apr 10, 2012, at 10:04 AM, Anthony Grimesreply@reply.github.com wrote:
|
We've been using the old version of fs (0.9 and 0.11.1) until now, and it looks like the changes to |
I decided to just make cwd a dynamic var. You can still simulate mutation by wrapping your code in @pbiggar The latest changes might make things easier on you. |
when you use fs.core/chdir from different threads concurrently, the single instance of cwd will get updated by all, which makes it kind of indeterministic,,, an alternative would be to make cwd thread-local or maybe inheritable-thread-local is better, but unfortunately that would break backwards compatibility as you would need a double deref "@@cwd" - or maybe there are other solutions (?).
I've forked your fs and implemented a solution based on inheritable-thread-local - didn't want to add a pull request as it breaks backwards compatibility - i'd be happy to contribute it - pls take a look: https://github.com/franks42/fs
(the inheritable-thread-local is based on useful.utils/thread-local but initializes the thread-local value with the parent's thread one).
-Regards, FrankS.
The text was updated successfully, but these errors were encountered: