这篇文章上次修改于 958 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

从 tokio::signal::ctrl_c() 收到消息,便说明收到了 ctrl+c 信号。

   tokio::select! {
        // pass the multistream to the http server, for letting clients to
        // access the VideoStreamBuffers
        _ = start_http_server(shared_multi_stream) => {}
        _ = tokio::signal::ctrl_c() => {
            info!("\nGot Ctrl+C: Stopping stream\n");
            // Signal other threads that the program should stop
            *running_mutex.lock().unwrap() = false;
        }
    }