Displaying 2 results from an estimated 2 matches for "factorialfactory".
2018 Feb 13
2
How to set environment variable XAPIAN_CJK_NGRAM?
...ds can
>> read the same variable concurrently without locking provided none of the
>> threads modifies the variable.
>
>That's true for simple types, but breaks down for classes because they
>may have mutable members - e.g. for caching values computed lazily:
>
>class FactorialFactory {
> private:
> mutable int r = -1;
> mutable int n;
> public:
> FactorialFactory() {}
>
> int calc(int v) const {
> if (r < 0 || n != v) {
> r = n;
> n = v;
> for (int i = n - 1; i > 1; --i) {
> r *= i;
>...
2018 Feb 08
7
How to ensure thread-safety
Hi,
I have read the concurrency webpage from the Xapian documentation:
http://getting-started-with-xapian.readthedocs.io/en/latest/concepts/concurrency.html
But it is still not clear to me how to ensure thread-safety when using
libxapian (C++ API). Usually when doing multi-threading many threads can
read the same variable concurrently without locking provided none of the
threads modifies the