global-uid was crazily un-thread-safe before.  This fixes.

A threaded server will have to pay some cost in global uid connection, but hey, at least it'll work.

@gabetax @yadavsaroj