ReentrantLock a Thread.sleep()

0

Pytanie jak na razie czysto teoretyczne. Czy jeśli pomiędzy metodami

ReentrantLock.lock() 

i ReentrantLock.unlock()

 wstawię <code class="java">Thread.sleep(jakis_czas) 

to czy wątek, który w danym momencie się wykonuje na "zalokowanym" kodzie odda dostęp do zasobu innym wątkom? Zgodnie z:

Thread.sleep causes the currently executing thread to sleep (temporarily cease execution) for the specified duration, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors, and resumption of execution will depend on scheduling and the availability of processors on which to execute the thread.

Jeżeli dobrze zrozumiałem powyższy tekst, to wątek nie oddaje dostępu do zasobu monitora. Ale czy ReentrantLock tworzy właśnie taki monitor?

0

Nie, ale takego ręcznego locka tym bardziej ci sleep nie zwolni :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1