+ while (wait) {
+ // See #3748:
+ //
+ // when the RTS is compiled into a DLL (wait==rtsTrue),
+ // the ticker thread must stop before we exit, or chaos
+ // will ensue. We can't kill it, because it may be
+ // holding a lock.
+ //
+ // When not compiled into a DLL, we wait for
+ // the thread out of courtesy, but give up after 200ms if
+ // it still hasn't stopped.
+ WaitForSingleObject(tickThread, 200);