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