Results 1 to 4 of 4
- 10-23-2009, 02:34 PM #1
Member
- Join Date
- Sep 2009
- Location
- Gouda, the Netherlands
- Posts
- 24
- Rep Power
- 0
Waiting on multiple semaphores at the same time
Hi,
Is it possible in Java to wait for multiple semaphores in one call? Like the waitformultipleobjects in win32. So I have multiple semaphores and i would like to be informed if one or more get signalled.
- 10-23-2009, 05:40 PM #2
You could keep looping through the semaphores calling tryAcquire() until you acquire a permit in a particular semaphore? In the loop make it sleep for a 10ms or so as to not burn all the CPU.
My Hobby Project: LegacyClone
- 10-23-2009, 05:45 PM #3
Member
- Join Date
- Sep 2009
- Location
- Gouda, the Netherlands
- Posts
- 24
- Rep Power
- 0
Looping and testing for, say, 10ms would give a latency of (on average) 5ms. I could reduce the sleep-time but then more cpu would be used, slowing other programs down and requirering more power (on e.g. laptops).
- 11-10-2009, 03:31 PM #4
Member
- Join Date
- Sep 2009
- Location
- Gouda, the Netherlands
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
upload multiple picture at one time
By chaiwei in forum Java AppletsReplies: 3Last Post: 10-30-2009, 05:39 AM -
Make multiple JTextFields focus at the same time.
By toymachiner62 in forum AWT / SwingReplies: 6Last Post: 10-09-2009, 02:59 AM -
Once again: waiting in a thread loop.
By willemjav in forum Threads and SynchronizationReplies: 115Last Post: 09-22-2008, 01:35 PM -
Waiting for a button to be pressed
By SomeGuyOverThere in forum New To JavaReplies: 6Last Post: 08-21-2008, 09:30 PM -
waiting for a file
By Fleur in forum New To JavaReplies: 2Last Post: 06-23-2008, 08:18 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks