handlers/context: protect global by a mutex