clean up and add wait queue

Signed-off-by: lizhizhou <lzz@meteroi.com>