[server][main] Stop some threads on the dedicated thread.

Some synchronous stop procedures use a GLib's main loop on the main
thread. Therefore, calling it (typically stop()) on the main thread
may causes the dead-lock.

This patch avoids the situation by calling a stop procedure on a
dedicated thread.
[server][main] Use a more suitable name.

impl ->
ctx

The data (structur) is not an implemention of any abstract object.
It's just used to save values for the main task/thread.
Merge pull request #717 from project-hatohol/fix-deadlock-at-exit

Fix deadlock at exit (#709)