Managing background thread termination during script cancellation
Streamlit scripts execute from top to bottom, and the st.stop() function allows for the immediate cessation of the current execution flow. However, this mechanism primarily halts the script's progression within the Streamlit runtime and does not natively signal termination to external resources. When developers launch background threads or subprocesses to ha