There's been some recent work on interrupts (in JVM): https://github.com/nrepl/nrepl/pull/153
FYI - I’ve ported the nREPL ops docs generation to cider-nrepl https://docs.cider.mx/cider-nrepl/nrepl-api/ops.html
Probably at some point we’ll have to make this reusable, so any middleware can use it, but at least I’ve solved the most pressing and long-standing issue of generating some API docs for cider-nrepl itself.
That is awesome, @bozhidar!!!
I can't remember if we can interrupt a thread that was spawned by the main session thread, but if if we are using a shared thread pool to run a fn, then without some knowledge of the threadpool, not sure how we can just interrupt something running in it?
(sorry, interlacing the conversation)
¯\(ツ)/¯
@shen If we can do this, that’d be great, but I’m not sure how we can get any insight as to where exactly some thread spawned from the main thread ended up.
I never really looked into this, though. I just assumed it probably wasn’t feasible (or it was pretty hard) if Chas didn’t implement it initially.
Do you know about the interrupting non-pooled thread part?
https://github.com/nrepl/nrepl/blob/f189b4c07579f8b6752f2e385e52c3680c2e1d60/src/clojure/nrepl/middleware/session.clj#L204-L207 <- how we make non-pooled threads
@shen What about it exactly? I don’t think we have any provisions for interrupting anything besides the session thread.
I think that even to be able to track the relationship between parent and child threads we need some explicit tracking with a ThreadGroup or something similar.
If I recall correctly Java threads don’t keep any info about the their children/parent threads.
I've never heard of that happening.
Ok. I wasn't sure if we had some way of doing that
sounds like a no then
the code quoted just creates the main session thread, right?