[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A doubt about multiple waits
I was with a doubt on Threads and Java.
In concurrency in win3ÀPI, you can use mutexes, semaphores and event
They would be a species of " Wait sets " of java, being that with
diferences (mainly event and mutex/semaphore). The handle_mutex can execute
WaitForSingleObject() and its thread is placed to sleep for the OS, when
(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
former: WaitForMultipleObjects(thread_handle, [ mutex_1, mutex_n ]);
Thread x, waits that one of the two mutexes either set free. This object of
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
not for thread, I I find that I understood but still I confuse myself, could
the respect to me?