Re: Threads

From: Andrew Valencia <>
Date: Sun Feb 27 1994 - 16:17:04 PST

[ (Gavin Thomas Nicol) writes:]

>One question about threads in VSTa: A thread is created by giving the
>address of a function to execute. Is returning from that function
>allowed? I have assumed it is not...

Emphatically not!

First, I don't copy the stack, which is a savings. Copy-on-write is fine,
but you're going to write all over your stack, so pay now or pay later, you'll
still pay.

But since threads share address space, copying stacks is a loss anyway--all
those neat frame pointers and stuff would point to the old stack, not the
new one. Thus, tfork(routine) sets up a fresh (empty) stack and starts
you running at the given routine. Now, I *wish* I'd allowed a second
argument, so that "routine" would be entered as:

routine(void *arg)

As currently there's no easy, reentrant way to send args to your new
thread. Somewhat incompatible, but worth it?

Received on Sun Feb 27 16:44:03 1994

This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 21:02:10 PDT