RunInBubble
Description: | Starts a new thread in the given child bubble and launches the given module into that script thread. |
Returns: | Boolean. See comments. |
Usage: | Script Only. |
Function Groups: | Bubbles and Threads |
Related to: | Bubble |BubbleList | BubbleQueueLength |BubbleReceive | BubbleSend |
Format: | RunInBubble(BubbleHandle, ThreadName, ModuleOrObject[, ImportDictionary]) |
Parameters: |
BubbleHandle |
Required bubble handle. A handle as returned by the Bubble and BubbleList functions. Specifies the bubble where the ModuleOrObject will be loaded and launched. |
ThreadName |
Required text. The name given to a new script thread that is started in the bubble. These names generally only appear in the user interfaces of debugging tools. |
ModuleOrObject |
Required. The root module that is loaded and launched into the bubble. It is always loaded and launched with no parent or caller. |
ImportDictionary |
Optional. If provided, a dictionary passed into this parameter allows the caller to specify a subset of variables, modules or both from the ModuleOrObject parameter that will be loaded, launched, or both, into the child bubble rather than simply loading and launching the entire module. This is of particular use when you want to be able to share the same code between modules running inside and outside of the child bubble. A complete description of this parameter is provided in the Bubble function. |
Comments: |
Returns TRUE if the module data was successfully transferred to the bubble. Returns FALSE otherwise, either because it was called with invalid parameter values or because the bubble specified in the given handle has already shut down. This function loads and launches modules in the same way as the Bubble function. |
Example:
{ A simple single-module RunInBubble call to get the VTScada memory use of a given bubble: } < GetBubbleMemory ( BubbleHandle; pMemoryUsed; ) [ BubbleMemoryWorker Module; MemoryUsed; ] Init [ If 1 WaitForResult; [ BubbleHandle = Bubble("GetBubbleMemory", \BubbleMemoryWorker {use backslash to avoid implicit launch}); ] ] WaitForResult [ If ReceiveBubbleMessage(MemoryUsed, BubbleHandle); [ *pMemoryUsed = MemoryUsed; Slay(); ] ] < BubbleMemoryWorker Main [ If 1; [ { Send the parent bubble the result. } SendBubbleMessage(Memory()); Slay(); ] ] { End of GetBubbleMemory\BubbleMemoryWorker } > { End of GetBubbleMemory } >