diff --git a/os/src/lib/dde_kit/interrupt.cc b/os/src/lib/dde_kit/interrupt.cc index b36f2e4..18fa5aa 100644 --- a/os/src/lib/dde_kit/interrupt.cc +++ b/os/src/lib/dde_kit/interrupt.cc @@ -68,8 +68,13 @@ class Irq_handler : Dde_kit::Thread, public Avl_node : Dde_kit::Thread(_compose_thread_name(irq)), _irq_number(irq), _irq(irq), _handler(handler), _init(init), _priv(priv), - _shared(shared), _handle_irq(1) - { start(); } + _shared(shared), _handle_irq(1), _lock(Lock::LOCKED) + { + start(); + + /* wait until thread is started */ + Lock::Guard guard(_lock); + } /** Enable IRQ handling */ void enable() @@ -93,6 +98,9 @@ class Irq_handler : Dde_kit::Thread, public Avl_node /* call user init function before doing anything else here */ if (_init) _init(_priv); + /* unblock creating thread */ + _lock.unlock(); + while (1) { _irq.wait_for_irq();