pthread_cleanup_pop_restore - what is it?
Question
pthread_cleanup_pop_restore - what is it?
It is from glibc. And it is called too often and eats a lot of cpu time.
The program uses a lot of getc() calls. I can't change the program (it is the benchmark with fixed source), but want to make it run faster.
Solution
It is a function!
which in turn, will deregister cleanup function from pthread_cancel
's cleanup queue. When glibc io function (with file locking enabled in glibc) will be interrupted by pthread_cancel, it will have a only chance of unlocking file descriptor. This chance is the this function counterpart.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow