1. A method comprising: monitoring each of a plurality of accesses by a multithreaded program to shared data structures stored within a database, the accesses being implemented by varying application programming interface (API) methods; determining, based on pre-defined synchronization safeguards, whether each of the accesses is valid or invalid based on the utilized corresponding API method, wherein the pre-defined synchronization safeguards comprise, for each API, an associated access contract that specifies what types of accesses are valid and what types of access are invalid, wherein the synchronization safe guards are included in a shared state associated with the shared data structures, wherein the determining comprises checking the associated access contract for the corresponding API; allowing those accesses to the shared data structures that were determined to be valid to proceed; and preventing those accesses to the shared data structures that were determined to be invalid from proceeding.