.. index:: single: timeout
.. _timeout/0:

.. rst-class:: right

**object**

``timeout``
===========

Predicates for calling goal with a time limit.

| **Availability:** 
|    ``logtalk_load(timeout(loader))``

| **Author:** Paulo Moura
| **Version:** 0:10:0
| **Date:** 2022-06-15

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Dependencies:**
|   (none)


| **Remarks:**

   - Supported backend Prolog systems: B-Prolog, ECLiPSe, XVM, SICStus Prolog, SWI-Prolog, Trealla Prolog, XSB, and YAP.

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: call_with_timeout/2
.. _timeout/0::call_with_timeout/2:

``call_with_timeout/2``
^^^^^^^^^^^^^^^^^^^^^^^

Calls a goal deterministically with the given time limit (expressed in seconds). Note that the goal may fail or throw an error before exhausting the time limit.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``call_with_timeout(Goal,Timeout)``
| **Meta-predicate template:**
|    ``call_with_timeout(0,*)``
| **Mode and number of proofs:**
|    ``call_with_timeout(+callable,+positive_number)`` - ``zero_or_one``

| **Exceptions:**
|    Goal does not complete in the allowed time:
|        ``timeout(Goal)``


------------

.. index:: call_with_timeout/3
.. _timeout/0::call_with_timeout/3:

``call_with_timeout/3``
^^^^^^^^^^^^^^^^^^^^^^^

Calls a goal deterministically with the given time limit (expressed in seconds) returning a reified result: ``true``, ``fail``, ``timeout``, or ``error(Error)``.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``call_with_timeout(Goal,Timeout,Result)``
| **Meta-predicate template:**
|    ``call_with_timeout(0,*,*)``
| **Mode and number of proofs:**
|    ``call_with_timeout(+callable,+positive_number,--atom)`` - ``one``


------------

Protected predicates
--------------------

(none)

Private predicates
------------------

(none)

Operators
---------

(none)

