Freeciv21
Develop your civilization from humble roots to a global empire
fcthread.cpp
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #include "fcthread.h"
14 
15 fcThread::fcThread(void(tfunc)(void *), void *tdata)
16  : func(tfunc), data(tdata)
17 {
18 }
19 
20 void fcThread::set_func(void(tfunc)(void *), void *tdata)
21 {
22  func = tfunc;
23  data = tdata;
24 }
25 
26 fcThread::~fcThread() = default;
27 
29 {
30  QMutexLocker locker(&mutex);
31  if (func) {
32  (func)(data);
33  }
34 }
void set_func(void(tfunc)(void *), void *tdata)
Definition: fcthread.cpp:20
~fcThread() override
void run() Q_DECL_OVERRIDE
Definition: fcthread.cpp:28
void(* func)(void *data)
Definition: fcthread.h:29
fcThread()=default
void * data
Definition: fcthread.h:30
QMutex mutex
Definition: fcthread.h:31
get_token_fn_t func
Definition: inputfile.cpp:119