-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dmitry Baikov schrieb:
In addition to select() there's also
clock_nanosleep(CLOCK_MONOTONIC,
0, &tv, NULL), which in theory should give best resolution possible.
To set realtime privileges, use (taken from jack):
struct sched_param rtparam;
memset (&rtparam, 0, sizeof (rtparam));
rtparam.sched_priority = priority;
pthread_setschedparam (thread, SCHED_FIFO, &rtparam);
Interesting project, btw. I planned to start something like this myself.
Please, publish results of your timing experiments - very interesting!
Dmitry.
Taken your code to set the thread to realtime I now get very exactly 78
bpm which don't change much.
On the one hand this indicates the thread running stable in realtime but
having a restriction to ~4ms/4000µs. Perhaps this is an in-system value
of sleep and the select approach Robin Gareus posted will help out.
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFF8w7GVC26eJ+o0+0RAnEfAKCXD2rWLK+MO4kFWyzd7PwtVL/qWgCgnYUi
/M3jB2t4fatk/SXnWUKTAe4=
=MzSS
-----END PGP SIGNATURE-----