1

My program has different threads and one common logging thread will be running.

All my threads have to dump some logging data into a buffer in logging thread. The logging thread in-turn will write into log file once the buffer reaches some size.

How can i write into the common buffer without affecting the performance of the running threads.? I am thinking of some way without much overhead instead of using mutex or any other sync mechanisms.

Sel_va
  • 588
  • 5
  • 25

1 Answers1

0

You may find that the performance penalties of using a mutex are low enough that it's just not worth the hassle of trying to make a Multi-producer, single consumer queue. However this question asks about such things and there are a few suggestions provided.

Community
  • 1
  • 1
Arunas
  • 1,282
  • 1
  • 11
  • 17