add static var and pthread hook