English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / ReLauncher: TThreadedRun.h Source File
Uranie / ReLauncher  v4.10.0
/* @license-end */
TThreadedRun.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2024 CEA/DES
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or any
7 // later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 // $Id$
19 // $Author$
20 // $Date$
21 // $Revision 1.4 $
22 // $State$
24 
32 #ifndef __TTHREADEDRUN__
33 #define __TTHREADEDRUN__
34 
35 #include <pthread.h>
36 #include <queue>
37 
38 #include "TShareRun.h"
39 
40 namespace URANIE
41 {
42 namespace Relauncher
43 {
44 
45 class TThreadedRun;
46 
47 struct job
48 {
49  int id;
51  pthread_t thr;
52 };
53 
54 class TThreadedRun: public TShareRun
55 {
56 protected:
57  long _nbnode;
58  int _runcore;
59 
60  pthread_mutex_t _mutex_in, _mutex_out;
61  pthread_cond_t _invide, _outvide;
62  std::queue<struct element> _qin;
63  std::queue<struct relement> _qout;
64  std::vector<struct job> _job;
65 
66  struct element serviceGet();
67  void servicePut(long, int);
68 
69 public:
70  TThreadedRun(TEval *, long);
71  virtual ~TThreadedRun(void);
72 
73  virtual void startSlave(void);
74  virtual Bool_t onMaster(void);
75  virtual void stopSlave(void);
76 
77  void calcul_loop(int);
78  virtual void put(long int, std::vector<URANIE::DataServer::UEntry*>*, std::vector<URANIE::DataServer::UEntry*>*, int =0 );
79  virtual Bool_t readyToGet();
80  virtual int get(long &);
81 
82  ClassDef(URANIE::Relauncher::TThreadedRun, ID_RELAUNCHER)
83 };
84 
85 }
86 }
87 
88 #endif
Definition: TBaseEval.cxx:44
virtual void put(long int, std::vector< URANIE::DataServer::UEntry *> *, std::vector< URANIE::DataServer::UEntry *> *, int=0)
Definition: TThreadedRun.cxx:147
int _runcore
Definition: TThreadedRun.h:58
std::queue< struct element > _qin
Definition: TThreadedRun.h:62
virtual ~TThreadedRun(void)
Definition: TThreadedRun.cxx:62
virtual Bool_t onMaster(void)
Definition: TThreadedRun.cxx:122
void servicePut(long, int)
Definition: TThreadedRun.cxx:180
Definition: TThreadedRun.h:47
pthread_mutex_t _mutex_in
Definition: TThreadedRun.h:60
pthread_t thr
Definition: TThreadedRun.h:51
std::queue< struct relement > _qout
Definition: TThreadedRun.h:63
TThreadedRun(TEval *, long)
Definition: TThreadedRun.cxx:48
std::vector< struct job > _job
Definition: TThreadedRun.h:64
TRun base class.
pthread_cond_t _invide
Definition: TThreadedRun.h:61
struct element serviceGet()
Definition: TThreadedRun.cxx:164
pthread_cond_t _outvide
Definition: TThreadedRun.h:61
long _nbnode
Definition: TThreadedRun.h:57
void calcul_loop(int)
Definition: TThreadedRun.cxx:74
Definition: TThreadedRun.h:54
virtual void stopSlave(void)
Definition: TThreadedRun.cxx:127
virtual void startSlave(void)
Definition: TThreadedRun.cxx:109
Definition: TShareRun.h:65
TThreadedRun * run
Definition: TThreadedRun.h:50
Definition: TShareRun.h:54
Definition: TEval.h:49
int id
Definition: TThreadedRun.h:49
pthread_mutex_t _mutex_out
Definition: TThreadedRun.h:60
virtual Bool_t readyToGet()
Definition: TThreadedRun.cxx:197