(Illustration by Gaich Muramatsu)
On Wed, Jan 26, 2005 at 12:01:58AM +1030, Brett Lymn wrote: > +ENTRY(savecontext) > + pushq %rsp Ahh, makes sense, push quad instead of push long. I do wonder why there is no 'push all' equivalent. > *snip*snip*snip* > > > It actually seems to work now and it should be more portable. > > > > Hmmmm would it not be better to use pthreads instead? Most, if not all, > OS's these days have or can have a libpthread which makes the code even > more portable... There already is a pthread version (lwp/src-pt). I've used it with venus to debug some memory issues. Valgrind didn't like how LWP was messing around with the stacks. LWP-using applications do seem to be picky about the order in which created threads are executing and it looked like there was a problem when venus was trying to grab a lock. In some places the code seems to assume that the lock will be available and that no other threads will run. These are really bugs in the code that are currently (probably) harmless because of the cooperative threading model of LWP. Using pthreads does give better portability and allows us to debug deadlock or memory problems with gdb and valgrind. I'll see if I can get lwp-pt built on a recent cygwin, the fact that no matter how well it worked we still needed the old version for Windows was one of the reasons why we never really pushed this code further. JanReceived on 2005-01-25 14:42:42