Introducing a global variable to define the number of threads

* NEWS: Announce
* spot/Makefile.am: Add pthread to use threads
* spot/misc/common.cc,
  spot/misc/common.hh: Add variable + getter/setter
* spot/misc/Makefile.am: Add common.cc
This commit is contained in:
Philipp Schlehuber-Caissier 2022-05-15 23:54:18 +02:00
parent b11208440b
commit e064726b64
5 changed files with 46 additions and 1 deletions

3
NEWS
View file

@ -23,6 +23,9 @@ New in spot 2.10.6.dev (not yet released)
Library:
- A global variable, together with its setters and getters to define the
maximal number of threads is added to common.hh/common.cc
- The new function suffix_operator_normal_form() implements
transformation of formulas to Suffix Operator Normal Form,
described in [cimatti.06.fmcad].

View file

@ -35,7 +35,7 @@ SUBDIRS = misc priv tl graph twa twacube twaalgos ta taalgos kripke \
lib_LTLIBRARIES = libspot.la
libspot_la_SOURCES =
libspot_la_LDFLAGS = $(BUDDY_LDFLAGS) -no-undefined $(SYMBOLIC_LDFLAGS)
libspot_la_LDFLAGS = $(BUDDY_LDFLAGS) -no-undefined -pthread $(SYMBOLIC_LDFLAGS)
libspot_la_LIBADD = \
kripke/libkripke.la \
misc/libmisc.la \

View file

@ -63,6 +63,7 @@ libmisc_la_SOURCES = \
bareword.cc \
bitset.cc \
bitvect.cc \
common.cc \
escape.cc \
formater.cc \
intvcomp.cc \

33
spot/misc/common.cc Normal file
View file

@ -0,0 +1,33 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2018 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config.h"
#include <spot/misc/common.hh>
static unsigned N_MAX_THREADS = 1;
void set_nthreads(unsigned nthreads)
{
N_MAX_THREADS = nthreads;
}
unsigned get_nthreads()
{
return N_MAX_THREADS;
}

View file

@ -169,3 +169,11 @@ namespace spot
# define SPOT_make_shared_enabled__(TYPE, ...) \
std::make_shared<TYPE>(__VA_ARGS__)
#endif
// Global variable to determine the maximal number of threads
SPOT_API void
set_nthreads(unsigned nthreads);
SPOT_API unsigned
get_nthreads();