gst: make gst_init() thread-safe