Added pthread compatibility functions for cleanup_push and pop