I have a code that "sounds" like this:
thread 1
now = rdtsc();
for_each_member_in_a_list {
if ( member_in_list.deadline() <= now ) {
do_something;
}
}
thread 2
now = rdtsc();
for_each_member_in_a_list {
member_in_list.updatedealine( foo(now, ...) );
}
now while this was working good in the past now with a SMP system this code doesn't work as intended. I think I will use clock_gettime with CLOCK_MONOTONIC, but I would like to ear some other hints first.