AshlinHarris / Spinners.jl

Command line spinners in Julia with Unicode support
MIT License
13 stars 1 forks source link

Wait for interactive thread to finish clean up #93

Closed AshlinHarris closed 1 year ago

AshlinHarris commented 1 year ago

I have not found a simple way to make the main thread wait for the timer to finish. As a result, the final cleanup step has been running after the REPL prints a new line, so the final frame isn't cleared.

Can anything like fetch or wait from Distributed.jl be made to work here? Otherwise, the signaling mechanism might have to be modified to allow reply signals from the interactive thread.

AshlinHarris commented 1 year ago

For now, I've just added sleep(0.5) in the macro after the close signal is sent.

AshlinHarris commented 1 year ago

The docs say wait or fetch should work. I'll experiment some more with the timer and spinner status.

AshlinHarris commented 1 year ago

The functiontimer_spin needs to wait until the timer is closed before returning, but I believe wait(Timer()) just wakes up the thread everytime the Timer elapses.

AshlinHarris commented 1 year ago

The next PR should fix this issue. Instead of waiting for the timer to be closed, timer_spin just waits until the spinner status is closed.

Additionally, I removed the const designation from the signaling function, since this caused issues with repeated calls.