Exemple #1
0
/**
 * Take the semaphore
 */
function lib_scheduling_sema_take()
{
    global $semaphore;
    global $time;
    // try to get the semaphore
    if (my_sem_acquire_or_continue($semaphore)) {
        return;
    }
    // Remove semaphore if it is 30sec or more old to avoid dead locks
    $now = time();
    if ($time && $now - $time > 30) {
        lib_scheduling_warning('Scheduler::sema[deadlock]{remove semaphore}');
        lib_scheduling_file_rm(lib_scheduling_config('var-path') . lib_scheduling_config('sem-key') . '.sem');
    }
    // Wait for the semaphore
    my_sem_acquire($semaphore);
}
Exemple #2
0
function lib_scheduling_file_move($from, $to)
{
    if (copy($from, $to)) {
        return lib_scheduling_file_rm($from);
    }
    return false;
}