Linux porting
Porting to linux Reorganising the code Improving the scan function
This commit is contained in:
10
lf_mpmc.h
10
lf_mpmc.h
@@ -173,11 +173,11 @@ static void mpmc_push(MPMCQueue *q, void *item) {
|
||||
|
||||
} else if (diff < 0) { // queue actually full
|
||||
|
||||
Sleep(1000);
|
||||
sleep_ms(1000);
|
||||
|
||||
} else { // waiting to grow
|
||||
|
||||
Sleep(0);
|
||||
sleep_ms(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,11 +220,11 @@ static void mpmc_push_work(MPMCQueue *q, void *item) {
|
||||
|
||||
} else if (diff < 0) { // queue actually full
|
||||
|
||||
Sleep(1000);
|
||||
sleep_ms(1000);
|
||||
|
||||
} else { // waiting to grow
|
||||
|
||||
Sleep(0);
|
||||
sleep_ms(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ static void *mpmc_pop(MPMCQueue *q) {
|
||||
|
||||
} else { // slot is still transitioning (written by another thread)
|
||||
if (++spins > 10) {
|
||||
Sleep(0); // yield CPU
|
||||
sleep_ms(0); // yield CPU
|
||||
spins = 0;
|
||||
} else {
|
||||
cpu_pause();
|
||||
|
||||
Reference in New Issue
Block a user