https://github.com/tolitius/jna-posix-sleeper
Snooze Like a Real Geek!
https://github.com/tolitius/jna-posix-sleeper
Last synced: 8 months ago
JSON representation
Snooze Like a Real Geek!
- Host: GitHub
- URL: https://github.com/tolitius/jna-posix-sleeper
- Owner: tolitius
- Created: 2011-09-16T15:49:50.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-09-16T15:54:04.000Z (about 14 years ago)
- Last Synced: 2025-01-06T13:49:53.028Z (9 months ago)
- Language: Java
- Homepage:
- Size: 97.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# What is "JNA POSIX Sleeper"?
When feeling sleepy, especially on those Monday mornings, snooze like a real geek! => Call into POSIX from JVM via Java Native Access
```scala
/**
*POSIX usleep has a microsecond precision: "The usleep() function shall cause the calling thread to be
* suspended from execution until either the number of realtime microseconds"
*
*Hence picking at POSIX's "pselect", but not for its ability to "monitor multiple file descriptors", rather for
* its ability to handle timeouts with a nanosecond precision.
*
*Who are we kidding!? Of course this is not run against hard realtime RTOS microkernel, and of course JNA it self
* has a greater than several microseconds overhead, but hey, it's fun !!!
*
* @author anatoly.polinsky
*/
object GoodNightSleeper {...}
```### Feeling Adventurous?
Java version works like a charm.
Scala one is ready to go, but needs a JNA Scala'образный "Structure" hook from [Scala Native Access](http://code.google.com/p/scala-native-access/)