Kaffe and Native Threads

Tony Juricic tony at magg.net
Mon Dec 1 22:34:40 PST 1997

John D. Gwinner wrote:

> I'll comment on the other parts tomorrow; I want to think about using the
> Semaphores to schedule the threads.  The more I think about it, issues
> like TLS (Thread Local Storage) and some synchronization issues might make
> this harder than I initially thought.

If this can help, here is my main mental block:

- invoking thread method on current thread versus invoking
  it on another thread.

Invoking a method on current thread seems easy: you just
call corresponding Win32 native thread method. Doing it
on another thread is a problem.

Consider the example where you have some:

classTimer extends Thread 

and the main method ( executed by main thread) that
does something like:

Timer timer = new Timer;


Implication is that the main thread commands
the secondary thread that it started. In Win32 you
can tell to any thread, but within the context of the very same 
thread, to go sleep, to suspend itself or to exit. But: how do you
do it from another thread without making another thread
constantly checking some conditions?

Some sort of exception, so that polling or waiting
on events or semaphores is not required, would be
the best imaginary solution. That is, as soon as some
thread decides to put another thread to stop or to sleep,
target thread will get the message and behave accordingly.

Of course, it is possible that I am stuck inside some
interpretation and understanding of Java and Win32
threads. That is why I post this.



More information about the kaffe mailing list