M8Test Help

filter

val threadName = "secondThread" val thread = _threads.start(threadName) { _console.log("子线程开始") // 模拟耗时操作 _threads.sleep(1000) _console.log("子线程结束") } // 主线程执行完成, 但是还没有停止, 会等待所有的子线程停止后才会停止, 主线程停止也就表示脚本停止 _console.log("主线程执行") _threads.sleep(500) _console.log(_threads.filter { it.getName() == threadName })
def threadName = "secondThread" def thread = $threads.start(threadName) { $console.log("子线程开始") // 模拟耗时操作 $threads.sleep(1000) $console.log("子线程结束") } // 主线程执行完成, 但是还没有停止, 会等待所有的子线程停止后才会停止, 主线程停止也就表示脚本停止 $console.log("主线程执行") $threads.sleep(500) $console.log($threads.filter { it.getName() == threadName })
<?php $console->log($threads->filter(function () { return true; }));
Last modified: 29 April 2025