MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / heartbeat_thread

Function heartbeat_thread

cranelift/filetests/src/concurrent.rs:116–126  ·  view source on GitHub ↗

Spawn a heartbeat thread which sends ticks down the reply channel every second. This lets us implement timeouts without the not yet stable `recv_timeout`.

(replies: Sender<Reply>)

Source from the content-addressed store, hash-verified

114/// Spawn a heartbeat thread which sends ticks down the reply channel every second.
115/// This lets us implement timeouts without the not yet stable `recv_timeout`.
116fn heartbeat_thread(replies: Sender<Reply>) -> thread::JoinHandle<()> {
117 thread::Builder::new()
118 .name("heartbeat".to_string())
119 .spawn(move || {
120 file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
121 while replies.send(Reply::Tick).is_ok() {
122 thread::sleep(Duration::from_secs(1));
123 }
124 })
125 .unwrap()
126}
127
128/// Spawn a worker thread running tests.
129fn worker_thread(

Callers 1

newMethod · 0.85

Calls 8

is_okMethod · 0.80
newFunction · 0.50
initializeFunction · 0.50
unwrapMethod · 0.45
spawnMethod · 0.45
nameMethod · 0.45
to_stringMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected