ok I have it working now, for some reason in Linux function like
std::this_thread::yield(); and _mm_pause();
behave quite different than in widows systems.
I make so that In non windows system function and intead we use teh old style Semphores, and
- Code: Select all
void dgThread::dgSemaphore::Wait()
{
std::unique_lock <std::mutex> lck(m_mutex);
while (m_count == 0)
{
m_sem.wait(lck);
}
m_count --;
}
this mean the jobs are not longer lock free in windows, I guess that is because in Linux thread do no get preempt like in windows, do you can not really count that std::this_thread::yield() will yield to a thread on the same core, or do nothing like in window.
later when I have more time I will check out how teh same can be done.
This is one case where is good to use a third party thread library instead of rolling your own.
but I have not found a reliable thread library,
Intel Building Blocks is support to be very good but is not free.
anyway I try in debug, not in release yet, please try again and tell me what you get.
edit: I now buidl the release, and it seem to work here.
It is no bad considering my laptop is an entry level amd 200 ghz ryzen with 4 cores 8 thread but who's counting.