On 04/19/2016 11:11 PM, Earl Pottinger (Redacted sender
earl_colby_pottinger for DMARC) wrote:
I solved my problem, but by doing it a different way than you suggested.
The original code when at rest showed that it was still using 70% CPU
time if there was no other program running.
All threads were running in a 'while' loop with a snooze(1LL) at the end
of the loop, increasing the snooze time lowed the CPU time used during
rest but make the compression slower.
I added two additional flags THREAD_SUSPEND and THREAD_RUNNING.
When a thread received the THREAD_SUSPEND I increased the snooze time to
99LL, and when a thread receives THREAD_RUNNING the snooze time is
decreased to 0LL. So just before compression I send a THREAD_RUNNING
flag and after I finished saving the data I send a THREAD_SUSPEND flag.