Changes between Initial Version and Version 1 of Ticket #26608, comment 30


Ignore:
Timestamp:
08/07/19 16:07:36 (2 years ago)
Author:
embray
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26608, comment 30

    initial v1  
    1616 * In the generated `Makefile` this also adds some bits, such as `MT_LIBS=-lpthread`, the file `parimt.h` contains the contents of `src/mt/pthread.h`, and the module `src/mt/pthread.c` which implements an standard interface (including the `pari_mt_init` function), is built, alongside some generic code in `src/mt/mt.c`
    1717   * If instead we'd had `--mt=single` (the default) it would compile `src/mt/single.c` which implements the same interfaces, mostly as no-ops (its `pari_mt_init` just sets the global variable `pari_mt_nbthreads = 1`).
     18
     19 * In `src/mt/pthread.c` there is a global pointer declared `static struct mt_pstate *pari_mt`.  This is a pointer to a `struct mt_pstate` which contains several variables related to the state of pari's thread pool, including pointers to the threads themselves.
     20   * When functions like `mt_queue_start()` or `mt_queue_start_lim()` (which `mt_queue_start()` is just a wrapper for) it initializes one of these `mt_pstate` structs, and sets the global `pari_mt` to point to it.
     21   * The global `pari_mt` is also referenced in `mt_queue_reset()`.
     22   * `pari_mt` also contains a reference to one mutex, which is used when calling `mt_queue_get` to synchronize access to per-thread results in such a way that it blocks until a result is available (but also allows interruption by sigint).