Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tcp #2667

Merged
merged 6 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/API/HTTPRequestClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ The `.url` property contains <!-- REF #HTTPRequestClass.url.Summary -->the URL o
<!-- REF #HTTPRequestClass.wait().Desc -->
## .wait()

<!-- REF #HTTPRequestClass.wait().Syntax -->**.wait**( { *time* : Real } ) : 4D.HTTPRequest<!-- END REF -->
<!-- REF #HTTPRequestClass.wait().Syntax -->**.wait**( { *timeout* : Real } ) : 4D.HTTPRequest<!-- END REF -->


<!-- REF #HTTPRequestClass.wait().Params -->
|Parameter|Type||Description|
|---------|--- |:---:|------|
|time|Real|->|Maximum time in seconds to wait for the response|
|timeout|Real|->|Maximum wait time in seconds|
|Result|4D.HTTPRequest|<-|HTTPRequest object|
<!-- END REF -->

Expand All @@ -481,12 +481,16 @@ The `.url` property contains <!-- REF #HTTPRequestClass.url.Summary -->the URL o
> This function is thread-safe.


The `wait()` function <!-- REF #HTTPRequestClass.wait().Summary -->waits for the response from the server<!-- END REF -->.
The `wait()` function <!-- REF #HTTPRequestClass.wait().Summary -->waits waits for a response from the server or until the specified `timeout` is reached<!-- END REF -->.

If a *time* parameter is passed, the function will wait at most the defined number of seconds.
If a *timeout* is provided, the function waits for the specified duration in this parameter. Decimals are accepted.

If the response from the server has already arrived, the function returns immediately.

During a `.wait()` execution, callback functions are executed, whether from other `HTTPRequest` or [`SystemWorker`](SystemWorkerClass.md) instances, or other [`CALL WORKER`](../commands-legacy/call-worker.md) calls. You can exit from a `.wait()` by calling [`terminate()`](#terminate) from a callback.
:::note

During the .wait() execution, callback functions from workers are executed, whether they originate from other `HTTPRequest` or [`SystemWorker`](SystemWorkerClass.md) instances, or other [`CALL WORKER`](../commands-legacy/call-worker.md) calls. You can exit from a .wait() by calling [`terminate()`](#terminate) from a callback.

:::

<!-- END REF -->
18 changes: 12 additions & 6 deletions docs/API/SignalClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,28 @@ If the signal is already in the signaled state (i.e., the `signaled` property is
<!-- REF #SignalClass.wait().Params -->
|Parameter|Type||Description|
|---|---|---|---|
|timeout|Real|->|Maximum waiting time for the signal in seconds|
|timeout|Real|->|Maximum wait time in seconds|
|Result|Boolean|<-|State of the `.signaled` property|
<!-- END REF -->


#### Description

The `.wait( )` function <!-- REF #SignalClass.wait().Summary -->makes the current process wait until the `.signaled` property of the signal object to become **true** or the optional *timeout* to expire<!-- END REF -->.
The `.wait( )` function <!-- REF #SignalClass.wait().Summary -->waits until the `.signaled` property of the Signal object becomes **true** or the specified `timeout` is reached<!-- END REF -->.

To prevent blocking code, you can pass a maximum waiting time in seconds in the *timeout* parameter (decimals are accepted).

>**Warning**: Calling `.wait( )` without a *timeout* in the 4D main process is not recommended because it could freeze the whole 4D application.
To prevent blocking code, you can pass a maximum waiting time in seconds in the *timeout* parameter. Decimals are accepted.

If the signal is already in the signaled state (i.e. the `.signaled` property is already **true**), the function returns immediately, without waiting.

The function returns the value of the `.signaled` property. Evaluating this value allows knowing if the function returned because the `.trigger( )` has been called (`.signaled` is **true**) or if the *timeout* expired (`.signaled` is **false**).
The function returns the value of the .signaled property:
* **true** if the signal was triggered (`.trigger()` was called).
* **false** if the timeout expired before the signal was triggered.

:::note Warning

Calling `.wait()` without a *timeout* in the main process is not recommended, as it could freeze the entire 4D application.

:::

>The state of a process that waits for a signal is `Waiting for internal flag`.

Expand Down
14 changes: 8 additions & 6 deletions docs/API/SystemWorkerClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,21 +531,23 @@ This property is **read-only**.
<!-- REF #SystemWorkerClass.wait().Params -->
|Parameter|Type||Description|
|---------|--- |:---:|------|
|timeout|Real|->|Waiting time (in seconds)|
|timeout|Real|->|Maximum wait time in seconds|
|Result|4D.SystemWorker|<-|SystemWorker object|
<!-- END REF -->

#### Description

The `.wait()` function <!-- REF #SystemWorkerClass.wait().Summary -->waits until the end of the `SystemWorker` execution or the specified *timeout*<!-- END REF -->.
The `.wait()` function <!-- REF #SystemWorkerClass.wait().Summary -->waits until the end of the `SystemWorker` execution or the specified *timeout* is reached<!-- END REF -->.

In *timeout*, pass a value in seconds. The `SystemWorker` script will wait for the external process for the amount of time defined in the *timeout* parameter. If you omit the *timeout* parameter, the script execution will wait indefinitely.
The `.wait()` function waits until the end of processing of the `onTerminate` formula, except if the *timeout* is reached(If any is defined), or an error has occured. If *timeout* is reached, the `SystemWorker` is not killed.

Actually, `.wait()` waits until the end of processing of the `onTerminate` formula, except if the *timeout* is reached. If *timeout* is reached, the `SystemWorker` is not killed.
If you pass a *timeout* value, .wait() waits for the external process for the amount of time defined in the *timeout* parameter.

During a `.wait()` execution, callback functions are executed, especially callbacks from other events or from other `SystemWorker` instances. You can exit from a `.wait()` by calling [`terminate()`](#terminate) from a callback.
:::note

This function returns the SystemWorker object.
During the `.wait()` execution, callback functions are executed, whether they originate from other `SystemWorker` instances. You can exit from a `.wait()` by calling [`terminate()`](#terminate) from a callback.

:::

> This function is not necessary if you created the `SystemWorker` from a 4D worker process.

Expand Down
Loading