The resource loading... loading...

wait

The wait() function is used to set an event (signal) wait, and will block before the event (signal) is set; it supports setting a timeout parameter.

The wait() function returns whether the timeout has occurred. If so, it returns a true value.

bool

wait() wait(timeout)

The timeout parameter is used to set the waiting timeout in milliseconds.

timeout false number

function main() {
    var event = threading.Event()
    var t1 = threading.Thread(function(event) {
        var ret = event.wait(100)
        Log(`event.wait(100):`, ret)
        ret = event.wait()
        Log(`event.wait():`, ret)
    }, event)

    Sleep(1000)
    event.set()
    t1.join()
}

Test the return value of the wait() function.

{@fun/Threads/ThreadEvent/set set}, {@fun/Threads/ThreadEvent/clear clear}, {@fun/Threads/ThreadEvent/isSet isSet}

clear isSet