Home Forums C Programming multithreading on OSX Reply To: multithreading on OSX

#3404
si_icarus
Participant

Actually, I think I’ve actually identified the problem. I think it was the sleep() function in my thread loop. I understand why I need that if the loop is continuously running and doing heavy stuff, but do I need it in my case?

When I comment out the sleep line (As below), the behaviour looks a lot smoother and correct, maybe because as soon as I set the bHasRunThisFrame flag in the thread instance to false, the update function is called almost immediately (which is what I want), whereas with the sleep() function, maybe there was a delay of upto interval before the update kicked in?…. or something :P Is it bad to not have a sleep function in there?

// run the update function in another thread