diff options
author | Zheng Da <zhengda1936@gmail.com> | 2010-06-09 13:51:38 +0200 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2010-06-09 13:51:38 +0200 |
commit | 79110264f65e0209887dbe1b2a8609a34909c591 (patch) | |
tree | 6352c12d78dec83603c93ef8ef84deb3ddfd9773 | |
parent | 13e0bf0fc4959a448fe8d1f33eb6eac01b4c4e06 (diff) |
fix a race condition in the interrupt handler.
-rw-r--r-- | libddekit/interrupt.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libddekit/interrupt.c b/libddekit/interrupt.c index 5a545f5a..9128e4d0 100644 --- a/libddekit/interrupt.c +++ b/libddekit/interrupt.c @@ -208,6 +208,11 @@ ddekit_thread_t *ddekit_interrupt_attach(int irq, int shared, /* construct name */ snprintf(thread_name, 10, "irq%02X", irq); + ddekit_irq_ctrl[irq].handle_irq = 1; /* IRQ nesting level is initially 1 */ + ddekit_lock_init_unlocked (&ddekit_irq_ctrl[irq].irqlock); + ddekit_irq_ctrl[irq].cond = ddekit_condvar_init (); + ddekit_irq_ctrl[irq].thread_exit = FALSE; + /* allocate irq */ /* create interrupt loop thread */ thread = ddekit_thread_create(intloop, params, thread_name); @@ -215,12 +220,7 @@ ddekit_thread_t *ddekit_interrupt_attach(int irq, int shared, ddekit_simple_free(params); return NULL; } - - ddekit_irq_ctrl[irq].handle_irq = 1; /* IRQ nesting level is initially 1 */ ddekit_irq_ctrl[irq].irq_thread = thread; - ddekit_lock_init_unlocked (&ddekit_irq_ctrl[irq].irqlock); - ddekit_irq_ctrl[irq].cond = ddekit_condvar_init (); - ddekit_irq_ctrl[irq].thread_exit = FALSE; /* wait for intloop initialization result */ |