mardi 31 mars 2015

Intercepting sleep calls in C++

Is there a way to intercept calls to sleep and sleep-like functions in C++? I'd love to be able to replace the implementation with a no-op or in the alternative, multiply the sleep time. I imagine this would aid in determining correctness of concurrent programs as well as identifying a source of flakiness in tests.


I'm operating on a gigantic codebase, so using a wrapper function would be less satisfactory. Maybe there's a way to use ptrace or the same techniques that programs like valgrind use to intercept malloc?


Aucun commentaire:

Enregistrer un commentaire