[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DotGNU]Re: Thread.Join and the main thread
From: |
Russell Stuart |
Subject: |
[DotGNU]Re: Thread.Join and the main thread |
Date: |
20 May 2004 10:38:38 +1000 |
On Thu, 2004-05-20 at 03:38, Thong (Tum) Nguyen wrote:
> I can see two obvious solutions. Solution 1 is for ilrun to create a new
> thread for Main to run under (not the main system thread). That way, the
> thread which executes the program entry point won't be the thread which ends
> up waiting for foreground threads to finish. Solution 2 is to allow the
> ilrun's main to call some new method (ILThreadMainFinished?) after the
> program's entry point has been called but before it waits on all foreground
> threads to finish. The method would cause all threads waiting to join on
> the main system thread to exit.
>
> Solution 1 seems cleanest and lest hackish to me (by far) but does require
> that even the simplest of programs (on multithreaded profiles) to have two
> threads (three if you include the finalizer thread). What do you think?
My personal preference for threads is that in a non-threaded program
there shouldn't be any extra threads. Indeed, I would like to see
hb_gc.c not start a finalizer thread if there is only one thread running
- instead it should just run the finalizers synchronously.
- [DotGNU]Re: Thread.Join and the main thread,
Russell Stuart <=