[PATCH v2 2/3] server: Lock thread input keystate whenever it is modified.