Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Hi all, I need code to sync all my cores.
This was great fun, I had a couple of attempts before I found a solution.
I was wondering if anyone else has another solution?
Ok, the best way of doing that is to have a flag which the CPUs wait to become true, and when they start waiting, they increment a "waiting cpu count" variable. The initiator (i.e. the CPU that is doing the switch) would wait for the waiting count to equal the total number of processors, do some work, then set the continue flag (and reset the waiting count).