[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A doubt about multiple waits



Hi!

I was with a doubt on Threads and Java.

In concurrency in win3ÀPI, you can use mutexes, semaphores and event
objects.
They would be a species of " Wait sets " of java, being that with
philosophies
diferences (mainly event and mutex/semaphore). The handle_mutex can execute
WaitForSingleObject() and its thread is placed to sleep for the OS, when
they
(thread owner of mutex) finishes or it calls release, it is notified and
automatically he catches the mutex again (if we have more than one, the
OS scheduler chooses under its criteria).

The exists two doubts:

1) Exist some primitive in java for one thread to wait for more than one
object ?

former: WaitForMultipleObjects(thread_handle, [ mutex_1, mutex_n ]);
Thread x, waits that one of the two mutexes either set free. This object of
wait
can be any Kernel Object (socket, mutex, file, pipe, port, etc).

2) Already I read in some places that the competition in java is for object
and
not for thread, I I find that I understood but still I confuse myself, could
you say
the respect to me?

bye