Method and system for passing messages between threads
First Claim
1. A computer-implemented method for passing a message from a first thread of execution in a process to a second thread of execution in the process, comprising:
- instantiating a first thread queue for holding messages, the first thread queue being associated with the first thread of execution;
obtaining a first address associated with the first thread queue;
sending the first address to the second thread of execution, the second thread of execution being configured to create a second thread queue, to obtain a second address associated with the second thread queue, and to store the first address;
receiving the second address from the second thread in response to sending the first address;
creating the message at the first thread of execution in the process;
obtaining a reference associated with the message;
placing the reference into the second thread queue, wherein the reference is usable by the second thread of execution to access the message.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and system for passing messages between threads is provided, in which a sending thread communicates with a receiving thread by passing a reference to the message to a message queue associated with the receiving thread. The reference may be passed without explicitly invoking the inter-process or inter-thread message passing services of the computer'"'"'s operating system. The sending thread may also have a message queue associated with it, and the sending thread'"'"'s queue may include a reference to the receiving thread'"'"'s queue. The sending thread can use this reference to pass messages to the receiving thread'"'"'s queue.
141 Citations
21 Claims
-
1. A computer-implemented method for passing a message from a first thread of execution in a process to a second thread of execution in the process, comprising:
-
instantiating a first thread queue for holding messages, the first thread queue being associated with the first thread of execution; obtaining a first address associated with the first thread queue; sending the first address to the second thread of execution, the second thread of execution being configured to create a second thread queue, to obtain a second address associated with the second thread queue, and to store the first address; receiving the second address from the second thread in response to sending the first address; creating the message at the first thread of execution in the process; obtaining a reference associated with the message; placing the reference into the second thread queue, wherein the reference is usable by the second thread of execution to access the message. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A method for passing intraprocess messages between scripting threads in a process residing in a computer, the method comprising:
-
creating a first scripting thread of execution; creating a first thread queue for the first scripting thread; obtaining a first address associated with the first thread queue; creating a second scripting thread of execution; passing, to the second scripting thread, the first address for use by the second scripting thread to send messages to the first scripting thread; creating a second thread queue for the second scripting thread; obtaining a second address associated with the second thread queue; and passing, to the first scripting thread, the second address for use by the first scripting thread to send messages to the second scripting thread. - View Dependent Claims (8, 9, 10)
-
-
11. A method for compiling a program having a plurality of sections, the method comprising:
-
creating one of a plurality of scripting threads for each section of the program, each scripting threads executes an associated script for compiling the associated section, wherein each script is independent of the program; creating a control thread to asynchronously communicate with each of the plurality of scripting threads so that commands can be issued from the control thread to the plurality of scripting threads in parallel, wherein asynchronously communicating with each of the plurality of scripting threads via a plurality of message queues, each scripting thread being associated with a scripting thread queue of the plurality of message queues and the control thread being associated with at least one control thread queue of the plurality of message queues, thereby resolving interdependencies among different sections of the program that are being compiled; providing the control thread a reference to each scripting thread queue; providing each scripting thread a reference to a corresponding control thread queue of the plurality of control thread queues, thereby enabling the control thread to put at least one message in each scripting thread queue and each scripting thread to put a response message in its corresponding control thread queue; and interpreting each script using a script engine, the script engine having an inter-thread signaling mechanism, wherein the control thread uses the signaling mechanism to alert one of the plurality of scripting threads whenever the control thread has sent a message to the one scripting thread. - View Dependent Claims (12)
-
-
13. A system for compiling a program having a plurality of sections, the system comprising:
-
a computer; a plurality of scripts, each script for compiling one section of the program, wherein each script is independent of the program; a plurality of scripting threads executing on the computer, each scripting thread being associated with one of the plurality of scripts, wherein each section of the program is compiled under the direction of the associated script executed by the associated scripting thread; a control thread executing on the computer for coordinating the activity of the plurality of scripting threads by communicating asynchronously with the plurality of scripting threads via a plurality of message queues, thereby resolving interdependencies among different sections of the program that are being compiled, wherein the control thread is associated with one or more control thread queues of the plurality of message queues and each scripting thread is associated with a scripting thread queue of the plurality of message queues, the control thread has a reference to each scripting thread queue; each scripting thread has a reference to a corresponding control thread queue of the plurality of control thread queues, thereby enabling the control thread to put one or more of the messages in each scripting thread queue and each scripting thread to put a response messages in its corresponding control thread queue; and a script engine executing on the computer to interpret the script, the script engine having an inter-thread signaling mechanism, wherein the control thread uses the signaling mechanism to alert one of the scripting threads whenever the control thread has sent a message to the one scripting thread. - View Dependent Claims (14, 15, 16, 17)
-
-
18. A computer readable storage medium having computer executable instructions;
- the computer executable instructions performing a method for passing intraprocess messages between scripting threads in a process, the method comprising;
creating a first scripting thread of execution; creating a first thread queue for the first scripting thread; obtaining a first address associated with the first thread queue; creating a second scripting thread of execution; passing, to the second scripting thread, the first address for use by the second scripting thread to send messages to the first scripting thread; creating a second thread queue for the second scripting thread; obtaining a second address associated with the second thread queue; and passing, to the first scripting thread, the second address for use by the first scripting thread to send messages to the second scripting thread.
- the computer executable instructions performing a method for passing intraprocess messages between scripting threads in a process, the method comprising;
-
19. The computer readable storage medium of 18, further comprising:
- creating a message object;
inserting the message from the first scripting thread into the message object; obtaining a reference to the message object; and placing the reference into the second thread queue so that the second scripting thread can access the message.
- creating a message object;
-
20. The computer readable storage medium of 18, further comprising:
sending a signal from the first scripting thread to the second scripting thread to indicate to the second scripting thread that the message has been sent to the sent to the second scripting thread.
-
21. The computer readable storage medium of 18, further comprising:
-
inserting a flag in the message object to indicate that the message object is being responded to; and placing a reference to the message object into the first thread queue.
-
Specification