• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

9.6.1 A Prolog thread for each native thread (one-to-one)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Multithreaded applications
        • Multithreaded mixed C and Prolog applications
          • A Prolog thread for each native thread (one-to-one)
            • PL_thread_self()
            • PL_unify_thread_id()
            • PL_thread_attach_engine()
            • PL_thread_destroy_engine()
            • PL_thread_at_exit()
    • Packages
Availability:C-language interface function
int PL_thread_attach_engine(const PL_thread_attr_t *attr)
Creates a new Prolog engine in the calling thread. If the calling thread already has an engine the reference count of the engine is incremented. The attr argument can be NULL to create a thread with default attributes. Otherwise it is a pointer to a structure with the definition below. For any field with value `0', the default is used. The cancel field may be filled with a pointer to a function that is called when PL_cleanup() terminates the running Prolog engines. If this function is not present or returns FALSE pthread_cancel() is used. The flags field defines the following flags:
PL_THREAD_NO_DEBUG
If this flag is present, the thread starts in normal no-debug status. By default, the debug status is inherited from the main thread.
typedef struct
{ unsigned long     local_size;    /* Stack sizes (Kbytes) */
  unsigned long     global_size;
  unsigned long     trail_size;
  unsigned long     argument_size;
  char *            alias;         /* alias name */
  int              (*cancel)(int thread);
  intptr_t          flags;
} PL_thread_attr_t;

The structure may be destroyed after PL_thread_attach_engine() has returned. On success it returns the Prolog identifier for the thread (as returned by PL_thread_self()). If an error occurs, -1 is returned. If this Prolog is not compiled for multithreading, -2 is returned.

ClioPatria (version V3.1.1-21-gb8003bb)