tipc: improve function tipc_wait_for_cond()