you can't use the rt_ API (now known as alchemy), you should use the POSIX API. As I mentioned in our call, you can use clock_nanosleep() with CLOCK_MONOTONIC and TIMER_ABSTIME. That will give you a pseudo-periodic task, but you'll need to get a timestamp (with clock_gettime()) when the animation starts, then you can compute the desired time of future frames based on that.
However, if one or more frames overrun the allocated period, then later calls to clock_nanosleep() may return immediately and you may experience a backlog and there doesn't seem to be an easy way of detecting that from the return values of clock_nanosleep(). If there is a chance of this happening, maybe you are better off calling clock_gettime() and compute a value for nanosleep() at every frame instead. This way you can detect "underruns" and react to them appropriately (e.g.: skipping the next frame unless it's the last one ).