Handling an exception in a thread
Asked Answered
C

1

5

One of my threads entered the debugger. I want to switch to it, expect that stacktrace, choose a restart, etc... How can I do that?

I am using bordeaux-threads.

Cementum answered 6/1, 2017 at 9:46 Comment(2)
If you use SLIME, it should work automatically. Otherwise it depends on your implementation. In SBCL, (SB-THREAD:RELEASE-FOREGROUND) should let the other thread use the terminal.Nonce
(SB-THREAD:RELEASE-FOREGROUND) worked beautifully. I assume bordeaux-threads don't have portable way of doing it. You can submit your comment as an answer.Cementum
N
7

If you use SLIME, it should work automatically. Otherwise it depends on your implementation. In SBCL, (SB-THREAD:RELEASE-FOREGROUND) should let the other thread use the terminal.

SBCL manual, 12.8 Sessions/Debugging

Within a single session, threads arbitrate between themselves for the user's attention. A thread may be in one of three notional states: foreground, background, or stopped. When a background process attempts to print a repl prompt or to enter the debugger, it will stop and print a message saying that it has stopped. The user at his leisure may switch to that thread to find out what it needs. If a background thread enters the debugger, selecting any restart will put it back into the background before it resumes. Arbitration for the input stream is managed by calls to sb-thread:get-foreground (which may block) and sb-thread:release-foreground.

Nonce answered 6/1, 2017 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.