1. A method of detecting deadlock in a multithreading program, comprising the steps of: constructing an invocation graph having a single root and a plurality of nodes corresponding to one or more functions written in code of the multithreading program; computing a resource graph in accordance with one or more resource sets in effect at each node of the invocation graph, wherein computing a resource graph comprises constructing a set of nodes and edges in accordance with the resource sets in effect at each node of the invocation graph, and refining a definition of the resource graph through post-processing; and determining whether cycles exist between two or more nodes of the resource graph, wherein a cycle is an indication of deadlock in the multithreading program, wherein constructing, computing and determining are operations that are performed by a computer.