This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
New signal
|
New signal {( description )} -> Function result | ||||||||
Parameter | Type | Description | ||||||
description | Text |
![]() |
Description for the signal | |||||
Function result | Object |
![]() |
Native object encapsulating the signal | |||||
The New signal command creates a signal object.
A signal is a shared object which can be passed as parameter from a worker or process to another worker or process, so that:
Optionally, in the description parameter you can pass a custom text describing the signal. This text can also be defined after signal creation.
Since the signal object is a shared object (see Shared objects and shared collections), it can also be used to maintain user properties, including the signal.description property, by calling the Use...End use structure.
Returned value
The returned signal object contains the following properties and methods:
Property | Type | Description |
signal.signaled | Boolean | (read-only property) false at signal creation. Becomes true when the signal.trigger( ) method is called. |
signal.description | Text | Custom description of the signal, if any. |
Method | Description |
signal.wait( ) | Wait for the signal (calling process/worker) |
signal.trigger( ) | Trigger the signal (called process/worker) |
Here is a typical example of a worker that sets a signal:
C_OBJECT($signal)
$signal:=New signal("This is my first signal")
CALL WORKER("myworker";"doSomething";$signal)
$signaled:=$signal.wait(1) //wait for 1 second max
If($signaled)
ALERT("myworker finished the work. Result: "+$signal.myresult)
Else
ALERT("myworker has not finished in less than 1s")
End if
The "doSomething" method could be like:
C_OBJECT($1)
//any processing
//...
Use($1)
$1.myresult:=$processingResult //return the result
End use
$1.trigger() // The work is finished
signal.description
signal.signaled
signal.trigger( )
signal.wait( )
Product: 4D
Theme: Process (Communications)
Number:
1641
Created: 4D v17 R4
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)