发明名称 Asynchronous workflows
摘要 A system and method for implementing an asynchronous construct in a computer program. A state machine is generated from the computer program, and the program is translated to generate code that executes the state machine during runtime. The asynchronous construct may be made into a function that invokes an asynchronous function, passing the function as a callback, and then exits. When the asynchronous operation completes, the function is invoked as a callback, returning to a configuration equivalent to that prior to the asynchronous call. Variable closure may be used to maintain the state of variables during a state prior to invoking the asynchronous operation and a state after invoking the asynchronous operation.
申请公布号 US9411568(B2) 申请公布日期 2016.08.09
申请号 US201012760571 申请日期 2010.04.15
申请人 Microsoft Technology Licensing, LLC 发明人 Syme Donald;Hoban Luke;Ng Timothy Yat Tim;Lomov Dmitry
分类号 G06F9/44;G06F9/45 主分类号 G06F9/44
代理机构 代理人 Sullivan Kevin;Drakos Kate;Minhas Micky
主权项 1. A computer-based method of translating a target computer program to a target program executable code that includes program instructions to perform an asynchronous operation, comprising: a) determining a code fragment that includes an instruction for invoking the asynchronous operation; b) generating a representation of a state machine based on the code fragment and the instruction for invoking the asynchronous operation, the state machine having a first state corresponding to a first portion of the code fragment containing the instruction for invoking the asynchronous operation, and a second state corresponding to a second portion of the code fragment that is to be executed after the asynchronous operation completes; and c) generating executable program code for implementing and invoking the state machine at a runtime of the target computer program, the executable program code including one or more instructions for passing a wrapping function with the asynchronous invocation, the wrapping function setting and employing states of the state machine; the executable program code comprising computer program instructions executable by one or more processors to perform actions including: a) invoking the asynchronous operation from the first portion of the code fragment; b) setting the state machine to be in the second state; c) exiting from the first portion of the code fragment after invoking the asynchronous operation; and d) in response to a completion of the asynchronous operation, employing the state machine to invoke the second portion of the code fragment.
地址 Redmond WA US