On Fri, Aug 10, 2012 at 10:19:03 -0700, Matt Thomas wrote: > On Aug 10, 2012, at 9:58 AM, Joerg Sonnenberger wrote: > > > On Fri, Aug 10, 2012 at 04:36:17PM +0000, Emmanuel Dreyfus wrote: > >> Summary of the previous episode: NetBSD's swapcontext restores the > >> thread_self pointer. When using swapcontext() on a context obtained > >> from getcontext() in another thread, this makes two threads with the > >> same pthread_self, leading to chaos > > > > I maintain that trying to move contexts between threads is an inherently > > bad idea and that it is a very inefficient interface for implementing > > coroutines. I object to this change for the sake of misdesigned > > software. > > I concur. A thread's stack is its identity and one can't swap stacks > without swapping its sense of self. (granted thread local storage > helps but that isn't universally available).
+1 I'm not sure it's possible to come up with coherent semantic for mixing pthreads and *context functions in that way (even if stack is not used as thread identity). -uwe