dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) (12/20/88)
For those of you following my LWP postings ... I've decided to change the semantics a bit. Before, the InitLWP() call would bypass the subroutine's normal return vector and return directly to the caller. Unfortunetly, this means the subroutine does not restore any registers it saved on the stack so register initialization (or declaring arguments as register variables) was not allowed. Which is a bitch because you have to think about it. My thinking then was that the user thus not need to worry about checking InitLWP(), he simply had: InitLWP() (rest of subroutine that is now the LWP goes here) NOW, I changed the name to ForkLWP() and the call works more like fork. There are *no* register variable restrictions and you can do whatever you want. One now must say: if (descriptor = ForkLWP(stack, arglen)) return(descriptor); (rest of subroutine that is now the LWP goes here) or (if parent doesn't need the descriptor) if (ForkLWP(stack, arglen)) return; ForkLWP returns the descriptor to the parent and 0 to the child. I'll be posting much revised LWP stuff in a day or two. This actually has more power than InitLWP() because it allows you to 'fork' the subroutine at any time... you can choose whether you want the parent to return or to continue running. -Matt