How to implement polling wait in canister

I want to poll a parameter in the canister, and perform some other operations when there are other methods that change the current parameter. At present, the way I think of is the following code

let START = false;

loop {
    if START {
        // do some stuff
    } else {
        // wait
        let end_time = ic_cdk::api::time() + 1000000000; // one second interval
            loop {
                let current_time = ic_cdk::api::time();
                if current_time > end_time {
                    break;
                }
            }
    }
}

Is there any better way

You can’t use a spinlock on the IC. While executing a message, the time will (almost) always stay the same. For this use case I’d suggest you work with timers, which allow you to start a new message after a specified point in time