Lock threaded mainloop before reset callbacks for safety