Ejemplo n.º 1
0
void epyxfastload_detach(void)
{
    alarm_destroy(epyxrom_alarm);
    c64export_remove(&export_res_epyx);
    io_source_unregister(epyxfastload_io1_list_item);
    io_source_unregister(epyxfastload_io2_list_item);
    epyxfastload_io1_list_item = NULL;
    epyxfastload_io2_list_item = NULL;
}
Ejemplo n.º 2
0
int hardsid_close(void)
{
    /* Driver cleans up after itself */
    if (hsid_fd >= 0) {
        close(hsid_fd);
    }
    alarm_destroy(hsid_alarm);
    hsid_alarm = 0;
    return 0;
}
Ejemplo n.º 3
0
void alarm_context_destroy(alarm_context_t *context)
{
    lib_free(context->name);

    /* Destroy all the alarms.  */
    {
        alarm_t *ap;

        ap = context->alarms;
        while (ap != NULL) {
            alarm_t *ap_next = ap->next;

            alarm_destroy(ap);
            ap = ap_next;
        }
    }

    lib_free(context);
}
Ejemplo n.º 4
0
status_t thread_snooze (bigtime_t value)

/*
 * ARGUMENTS
 * * value : the number of microseconds to wait for
 *
 * RESULT
 * * DNA_ERROR: no more alarm slot or quantum too short
 * * DNA_OK: the operation succeeded
 *
 * SOURCE
 */

{
  int32_t alarm_id = -1;
  uint32_t current_cpuid = 0;
  thread_t self = NULL;
  thread_t target = NULL;
  interrupt_status_t it_status = 0;
  status_t status = DNA_OK;

  watch (status_t)
  {
    /*
     * Disable interrupts and get current information
     */

    it_status = cpu_trap_mask_and_backup ();

    current_cpuid = cpu_mp_id();
    self = cpu_pool . cpu[current_cpuid] . current_thread;

    /*
     * Create the snooze alarm and elect a new thread.
     */

    status = alarm_create (value, DNA_ONE_SHOT_RELATIVE_ALARM,
        thread_alarm, self, & alarm_id);
    check (alarm_error, status == DNA_OK, status);

    status = scheduler_elect (& target, true);
    ensure (status != DNA_ERROR && status != DNA_BAD_ARGUMENT, status);

    /*
     * Update self information and switch context.
     */

    lock_acquire (& self -> lock);
    self -> info . status = DNA_THREAD_SLEEPING;

    status = scheduler_switch (target, NULL);
    ensure (status == DNA_OK, status);

    /*
     * Cancel the alarm, just in case we came back from
     * sleeping after a thread_suspend/thread_resume combination.
     */

    status = alarm_destroy (alarm_id);
    ensure (status != DNA_NO_TIMER && status != DNA_BAD_ARGUMENT, status);

    cpu_trap_restore (it_status);
    return (status == DNA_OK) ? DNA_INTERRUPTED : DNA_OK;
  }

  rescue (alarm_error)
  {
    cpu_trap_restore (it_status);
    leave;
  }
}