st/wgl: add some mutex checking code