This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Santa { | |
volatile int reindeers = 0; | |
// Call this in any old thread when a reindeer arrives | |
public synchronized void reindeerArrived() { | |
reindeers++; | |
notify(); | |
} | |
// Returns only when 8 or more reindeer have come in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time scanimage -d net:localhost:pixma --resolution 600 > /tmp/blah | |
real 1m47.591s | |
user 0m0.015s | |
sys 0m0.159s | |
Equivalent Java test: | |
SaneDevice device = session.getDevice("pixma"); | |
device.open(); | |
device.getOption("resolution").setIntegerValue(600); | |
Stopwatch stopwatch = Stopwatch.createStarted(); |