At Fri, 10 Aug 2012 09:15:01 +0200, Neal H. Walfield wrote: > > Why does Viengoos in > > sysdeps/viengoos/pt-thread-halt.c:__pthread_thread_halt have to do > > different things depending on whether »thread == _pthread_self« or not? > > I'm assuming that on Mach, we can just always do thread_suspend (and take > > care to do a thread_abort before re-using it)? > > My recollection is that they are semantically equivalent in this case > (vg_suspend cause the calling thread to wait for a message; > vg_thread_stop marks the thread as not runnable), but vg_suspend is a > lot cheaper than vg_thread_stop.
I now remember the main motivation for this. Modifying a thread is an RPC, i.e., a reply is sent. When a thread stops itself, any reply will be dropped. As this is normally an error, Viengoos dumped a fair amount of debugging output when this condition occurred. To avoid this gratuitous output, I used vg_suspend instead. Neal