working hopefully - wakeup signal before each wait