Techniques for switching threads within routines
First Claim
1. A computer-readable memory storing computer-executable instructions for causing a computer to perform operations comprising:
- receiving a request from an originating routine to execute a coroutine;
executing an initial portion of the coroutine on an initial thread;
receiving a response back from the coroutine when the coroutine returns based upon a return statement, wherein the return statement identifies a subsequent thread different than the initial thread; and
executing a subsequent portion of the coroutine a subsequent time on the subsequent thread that was indicated by the coroutine in the return statement upon return.
2 Assignments
0 Petitions
Accused Products
Abstract
Various technologies and techniques are disclosed for switching threads within routines. A controller routine receives a request from an originating routine to execute a coroutine, and executes the coroutine on an initial thread. The controller routine receives a response back from the coroutine when the coroutine exits based upon a return statement. Upon return, the coroutine indicates a subsequent thread that the coroutine should be executed on when the coroutine is executed a subsequent time. The controller routine executes the coroutine the subsequent time on the subsequent thread. The coroutine picks up execution at a line of code following the return statement. Multiple return statements can be included in the coroutine, and the threads can be switched multiple times using this same approach. Graphical user interface logic and worker thread logic can be co-mingled into a single routine.
-
Citations
20 Claims
-
1. A computer-readable memory storing computer-executable instructions for causing a computer to perform operations comprising:
-
receiving a request from an originating routine to execute a coroutine; executing an initial portion of the coroutine on an initial thread; receiving a response back from the coroutine when the coroutine returns based upon a return statement, wherein the return statement identifies a subsequent thread different than the initial thread; and executing a subsequent portion of the coroutine a subsequent time on the subsequent thread that was indicated by the coroutine in the return statement upon return. - View Dependent Claims (2, 3, 4)
-
-
5. A method for switching threads partially through a routine comprising the steps of:
-
starting an execution of an initial portion of a routine on a first thread; exiting the routine at an end point of the initial portion of the routine due to a first return statement, with the first return statement having a subsequent thread identifier which identifies a subsequent thread different than the first thread; resuming code execution of a subsequent portion of the routine on the subsequent thread specified in the subsequent thread identifier; and picking up code execution in the routine at a line of code following the first return statement. - View Dependent Claims (6, 7, 8, 9, 10, 11, 12, 13)
-
-
14. A method for co-mingling graphical user interface logic and worker thread logic in a single routine comprising the steps of:
-
starting code execution of an initial portion of logic included in a coroutine, the initial portion of logic being executed on a first thread to receive user input; receiving the user input; exiting the coroutine partially through to switch to a second thread, the second thread identified by a return statement and being a different thread than the first thread; and resuming code execution of a subsequent portion of logic included in the coroutine on the second thread in response to the user input. - View Dependent Claims (15, 16, 17, 18, 19, 20)
-
Specification