[SessionManager] Get session ID without blocking.

Previos ways set GLib's timer on the GLib's event thread to race
with timerCb(). However, this approach needs a context switch and
makes the caller thread blocks.

This patch sets the timer on the caller's thread with a lock in
order to improve performance.