Reputation: 4872
I'm developing an application that needs to send out messages at specific times (it's to do with multimedia so the timing precision is important), so effectively I need a mechanism to call a callback function in a specified number of milliseconds.
I need to support both Windows and Mac OS X. I've looked into Timer Queues on Windows which looks like what I need, but I have read that the timing precision is just not precise enough for multimedia based applications (my application is sensing MIDI messages to a driver at specific times). Any ideas?
Upvotes: 0
Views: 857
Reputation: 59987
Any sleep function is 'a least' with all OS that I know of.
If theat OS has a lot of tasks it is up to the scheduler for those tasks.
In space they have dedicate hardware that does simple functions from a queue - that is the best you can get - and they are not croweded
Upvotes: 0
Reputation:
I think your best bet on Windows is to use Multimedia Timers. On OS X, the simplest function to use would be nanosleep
, but you can go a long way with kqueue. I don't think there will be any problems if you are talking milliseconds precision (a millisecond is a very, very long time). The only thing you will possibly need to do is to make sure OS runs your process as "real-time".
Upvotes: 1