Jacob Nikom wrote:
> I use SwingWorker class. If I don't have JNI methods I don't have
> to use yield() method. If I replace my Java methods with JNI calls
> I must use yield(), otherwise the application simply does not work.
> There is no mentioning of yield() method in any SwingWorker-related
> documentation.
You should not depend on threads being preemtive. Just suppose that
thread will switch ONLY when you sleep/yield/block and see if you
program can accomplish it's tasks. All this stuff with preemptivnes is
only important when you have to run some not fully trusted code - for
example applets or servlets, you have to be able to kill runaway thread.
In other cases one can really go away with cooperative threads (of
course good programs has to be written for worst case at every point -
a) that thread will never switch unless explicitly told to, b) thread
will switch at every possible point it can do something bad :)
Artur
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]