You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you look in Soul Engine\Source\Parallelism\Fiber\SchedulerAlgorithm.h you will find on line 57 boost::fibers::detail::spinlock. Essentially, when many threads try to access the localQueues_ the spin-lock only allows one thread at a time. If you used a mutex like std::mutex the thread might give control to another thread. This is really bad as we would be letting the operating system wrest control from our carefully optimized program! So, for the few cycles needed to access localQueues_ we use a spin-lock. The boost spin-lock is sufficient, but we would love to remove the boost dependency someday. Implement a modern spin-lock class and place it somewhere like Soul Engine\Source\Parallelism\Thread\Spinlock.h/.cpp
If you look in
Soul Engine\Source\Parallelism\Fiber\SchedulerAlgorithm.h
you will find on line 57boost::fibers::detail::spinlock
. Essentially, when many threads try to access thelocalQueues_
the spin-lock only allows one thread at a time. If you used a mutex likestd::mutex
the thread might give control to another thread. This is really bad as we would be letting the operating system wrest control from our carefully optimized program! So, for the few cycles needed to accesslocalQueues_
we use a spin-lock. The boost spin-lock is sufficient, but we would love to remove the boost dependency someday. Implement a modern spin-lock class and place it somewhere likeSoul Engine\Source\Parallelism\Thread\Spinlock.h/.cpp
Some helpful links:
https://stackoverflow.com/questions/5869825/when-should-one-use-a-spinlock-instead-of-mutex
https://www.boost.org/doc/libs/1_68_0/libs/fiber/doc/html/index.html
https://github.com/boostorg/fiber
The text was updated successfully, but these errors were encountered: