0
我有一個代碼,「聽起來」像這樣:快速診斷標記時間的最後期限
線程1
now = rdtsc();
for_each_member_in_a_list {
if (member_in_list.deadline() <= now) {
do_something;
}
}
線程2
now = rdtsc();
for_each_member_in_a_list {
member_in_list.updatedealine(foo(now, ...));
}
現在雖然這是工作在過去的好現在使用SMP系統,此代碼無法按預期工作。我想我會在CLOCK_MONOTONIC中使用clock_gettime,但我想先聽聽其他提示。
我正在使用無鎖數據結構。 – 2009-02-10 14:08:19