xenia-project / xenia

Xbox 360 Emulator Research Project
https://xenia.jp
Other
8.24k stars 1.14k forks source link

Make log AppendLine lock-free. #429

Open benvanik opened 9 years ago

benvanik commented 9 years ago

Currently the logging lock can lead to deadlocks when a thread is suspended while holding the lock. Taking a global lock prevents this but dramatically slows down any app with heavy logging. Making the ringbuffer operations lockfree (somehow? thread-local ringbuffers? etc?) would be ideal.

DrChat commented 7 years ago

AppendLine no longer uses a mutex, but a portion of the ring is still reserved for threads currently writing.

This will cause a livelock if the debugger tries to write to the log after pausing a thread that's currently writing.