On Fri, Jun 16, 2017 at 04:05:58PM -0400, Noam Postavsky wrote: > On Fri, Jun 16, 2017 at 3:45 PM, Alan Third wrote: > > The first one looks like the thread’s starting too quick? > > I think it's rather failing to be killed by the `thread-signal' call. Ah, yes. I completely misread the test. > > The second looks like the thread’s not dying quick enough? > > Same for that one. I don't know much about the thread internals, and > even less macOS internals though... Well, I’ve discovered that if I keep the mouse moving over the Emacs frame while the tests are running then none of them fail, so I think it’s something to do with ns_select jamming everything up for the duration of its timeout. I could probably get round that by getting the thread to fire off an NS app defined event when it dies. That would break ns_select out of its event loop, presumably letting the dying thread actually die... Amazingly that seems to have worked! Updated patch attached. -- Alan Third