modify signal handling.

Modify signal handling from asynchronous signal handler to synchronous signal handling thread.

To respect async-signal-safe.

Why do you unmask signals except TERM/INT/HUP here?