directive

threaded/0

Description

threaded

Declares that an object supports threaded engines, concurrent calls, and asynchronous messages. Any object containing calls to the built-in multi-threading predicates (or importing a category that contains such calls) must include this directive.

This directive results in the automatic creation and set up of an object message queue when the object is loaded or created at runtime. Object message queues are used for exchanging thread notifications and for storing concurrent goal solutions and replies to the multi-threading calls made within the object. The message queue for the user pseudo-object is automatically created at Logtalk startup (provided that multi-threading programming is supported and enabled for the chosen backend Prolog compiler).

Note

This directive requires a backend Prolog compiler providing compatible multi-threading primitives. The value of the read-only threads flag is set to supported when that is the case.

Template and modes

threaded

Examples

:- threaded.