Patent ID: 8918767

Claim:
At a computer system including one or more processors and system memory, the computer system also including one or more modules for converting source code into executable code, a method for transforming source code to await execution of asynchronous operations, the method comprising: an act of accessing an asynchronous method from within a portion of computer program source code; an act of recognizing a statement requesting to await the completion of an asynchronous operation, the statement included in the asynchronous method; in response to recognizing the statement, an act of transforming the statement into a plurality of other statements, the plurality of other statements configured to use an awaitable object to await completion of the asynchronous operation, the plurality of other statements configured to: use a first member of the awaitable object to determine a completion status of the asynchronous operation; use a second member of the awaitable object to await completion of the asynchronous operation when the completion status indicates that the asynchronous operation has not already completed, the second member configured to await completion of the asynchronous operation and to resume execution of the asynchronous method at a resumption point in the asynchronous method when the asynchronous operation completes; return to a calling context after awaiting completion of the asynchronous operation; resume execution of the asynchronous method at the resumption point subsequent to completion of the asynchronous operation; and use a third member of the awaitable object to access a result of the asynchronous operation subsequent to resuming execution of the asynchronous method.