1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz 1/2008 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2008
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MThread
|
---|
28 | //
|
---|
29 | // Implementing a slightly simplified interface to multi-threading
|
---|
30 | // based on TThread
|
---|
31 | //
|
---|
32 | //////////////////////////////////////////////////////////////////////////////
|
---|
33 | #include "MThread.h"
|
---|
34 |
|
---|
35 | ClassImp(MThread);
|
---|
36 |
|
---|
37 | using namespace std;
|
---|
38 |
|
---|
39 | // --------------------------------------------------------------------------
|
---|
40 | //
|
---|
41 | // Return the thread's state as string
|
---|
42 | //
|
---|
43 | TString MThread::GetThreadStateStr() const
|
---|
44 | {
|
---|
45 | switch (fThread.GetState())
|
---|
46 | {
|
---|
47 | case TThread::kInvalidState:
|
---|
48 | return "Invalid - thread was not created properly";
|
---|
49 | case TThread::kNewState:
|
---|
50 | return "New - thread object exists but hasn't started";
|
---|
51 | case TThread::kRunningState:
|
---|
52 | return "Running - thread is running";
|
---|
53 | case TThread::kTerminatedState:
|
---|
54 | return "Terminated - thread has terminated but storage has not yet been reclaimed (i.e. waiting to be joined)";
|
---|
55 | case TThread::kFinishedState:
|
---|
56 | return "Finished - thread has finished";
|
---|
57 | case TThread::kCancelingState:
|
---|
58 | return "Canceling - thread in process of canceling";
|
---|
59 | case TThread::kCanceledState:
|
---|
60 | return "Canceled - thread has been canceled";
|
---|
61 | case TThread::kDeletingState:
|
---|
62 | return "Deleting - thread in process of deleting";
|
---|
63 | };
|
---|
64 | return "Unknown";
|
---|
65 | }
|
---|
66 |
|
---|
67 | /*
|
---|
68 | {
|
---|
69 | TMethodCall call(cl, "Name", 0);
|
---|
70 |
|
---|
71 | if (!call.IsValid())
|
---|
72 | return 0;
|
---|
73 |
|
---|
74 | //const char *GetParams() const { return fParams.Data(); }
|
---|
75 | //const char *GetProto() const { return fProto.Data(); }
|
---|
76 |
|
---|
77 | switch (call.ReturnType())
|
---|
78 | {
|
---|
79 | case kLong:
|
---|
80 | break;
|
---|
81 | case kDouble:
|
---|
82 | break;
|
---|
83 | case kString:
|
---|
84 | break;
|
---|
85 | case kOther:
|
---|
86 | break;
|
---|
87 | case kNone:
|
---|
88 | break;
|
---|
89 | }
|
---|
90 |
|
---|
91 | // NOTE execute functions are locked by a global mutex!!!
|
---|
92 |
|
---|
93 | void Execute(void *object);
|
---|
94 | void Execute(void *object, Long_t &retLong);
|
---|
95 | void Execute(void *object, Double_t &retDouble);
|
---|
96 | void Execute(void *object, char **retText);
|
---|
97 |
|
---|
98 | void Execute();
|
---|
99 | void Execute(Long_t &retLong);
|
---|
100 | void Execute(Double_t &retDouble);
|
---|
101 | }
|
---|
102 | */
|
---|