Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXWorker.h
1 /********************************************************************************
2 * *
3 * W o r k e r T h r e a d *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2006,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXWORKER_H
22 #define FXWORKER_H
23 
24 #ifndef FXTHREAD_H
25 #include "FXThread.h"
26 #endif
27 
28 namespace FX {
29 
30 
39 class FXAPI FXWorker : public FXThread {
40 private:
41  FXRunnable *runnable;
42 private:
43  FXWorker(const FXWorker&);
44  FXWorker &operator=(const FXWorker&);
45 public:
46 
48  FXWorker(FXRunnable* task=nullptr);
49 
51  void setRunnable(FXRunnable* task){ runnable=task; }
52 
54  FXRunnable* getRunnable() const { return runnable; }
55 
57  virtual FXint run();
58 
60  static FXWorker* execute(FXRunnable* task,FXuval stacksize=0);
61 
63  virtual ~FXWorker();
64  };
65 
66 }
67 
68 #endif
FXThread provides system-independent support for threads.
Definition: FXThread.h:60
Definition: FX4Splitter.h:28
FXRunnable * getRunnable() const
Return runnable.
Definition: FXWorker.h:54
An FXWorker is a transient thread that performs an FXRunnable task.
Definition: FXWorker.h:39
void setRunnable(FXRunnable *task)
Change runnable if not started yet.
Definition: FXWorker.h:51
FXRunnable represents a generic runnable thing.
Definition: FXRunnable.h:33

Copyright © 1997-2022 Jeroen van der Zijp