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
Thread support for REPL #944
Conversation
@nviennot This looks pretty nifty, and from a quick play seems to work on ruby-1.9/2.0. On jruby, when I hit in the active REPL (and there's one waiting behind it) I get:
This is the file I was using to test: https://gist.github.com/5865649 It would also be nice to have some kind of unit-test coverage for this, though reliable multi-threaded tests are somewhat hard to engineer. There are a couple of places in the comments where you're using InputThreadOwner, old name? Is input.instance_eval { @pry_lock ||= Pry::InputLock.new } It might be nice to maintain a single hash of locks keyed by input so that the whole thing can be protected by a global mutex (instead of monkey-patching locks into existing objects). All of that said, I think this is much better than the current behaviour; so I'm happy to merge it in if you have no more time to spend on it and we can fix up problems later. |
I've address your comments in the above commits. I couldn't reproduce the JRuby issue you mentioned, but I'm pretty sure I fixed it. In terms of testing, I think unit tests are not going to be of much use. If we do testing, I'd much rather do some stress tests. Also, Travis seems to be pretty sad (tests do not complete)... Any idea what it could be? |
Without the patch, threads are behaving in a funny way when they each have their own REPL:
With the patch: