| 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 | using namespace std;
|
|---|
| 36 |
|
|---|
| 37 | // --------------------------------------------------------------------------
|
|---|
| 38 | //
|
|---|
| 39 | // Return the thread's state as string
|
|---|
| 40 | //
|
|---|
| 41 | TString MThread::GetThreadStateStr() const
|
|---|
| 42 | {
|
|---|
| 43 | switch (fThread.GetState())
|
|---|
| 44 | {
|
|---|
| 45 | case TThread::kInvalidState:
|
|---|
| 46 | return "Invalid - thread was not created properly";
|
|---|
| 47 | case TThread::kNewState:
|
|---|
| 48 | return "New - thread object exists but hasn't started";
|
|---|
| 49 | case TThread::kRunningState:
|
|---|
| 50 | return "Running - thread is running";
|
|---|
| 51 | case TThread::kTerminatedState:
|
|---|
| 52 | return "Terminated - thread has terminated but storage has not yet been reclaimed (i.e. waiting to be joined)";
|
|---|
| 53 | case TThread::kFinishedState:
|
|---|
| 54 | return "Finished - thread has finished";
|
|---|
| 55 | case TThread::kCancelingState:
|
|---|
| 56 | return "Canceling - thread in process of canceling";
|
|---|
| 57 | case TThread::kCanceledState:
|
|---|
| 58 | return "Canceled - thread has been canceled";
|
|---|
| 59 | case TThread::kDeletingState:
|
|---|
| 60 | return "Deleting - thread in process of deleting";
|
|---|
| 61 | };
|
|---|
| 62 | return "Unknown";
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | /*
|
|---|
| 66 | {
|
|---|
| 67 | TMethodCall call(cl, "Name", 0);
|
|---|
| 68 |
|
|---|
| 69 | if (!call.IsValid())
|
|---|
| 70 | return 0;
|
|---|
| 71 |
|
|---|
| 72 | //const char *GetParams() const { return fParams.Data(); }
|
|---|
| 73 | //const char *GetProto() const { return fProto.Data(); }
|
|---|
| 74 |
|
|---|
| 75 | switch (call.ReturnType())
|
|---|
| 76 | {
|
|---|
| 77 | case kLong:
|
|---|
| 78 | break;
|
|---|
| 79 | case kDouble:
|
|---|
| 80 | break;
|
|---|
| 81 | case kString:
|
|---|
| 82 | break;
|
|---|
| 83 | case kOther:
|
|---|
| 84 | break;
|
|---|
| 85 | case kNone:
|
|---|
| 86 | break;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | // NOTE execute functions are locked by a global mutex!!!
|
|---|
| 90 |
|
|---|
| 91 | void Execute(void *object);
|
|---|
| 92 | void Execute(void *object, Long_t &retLong);
|
|---|
| 93 | void Execute(void *object, Double_t &retDouble);
|
|---|
| 94 | void Execute(void *object, char **retText);
|
|---|
| 95 |
|
|---|
| 96 | void Execute();
|
|---|
| 97 | void Execute(Long_t &retLong);
|
|---|
| 98 | void Execute(Double_t &retDouble);
|
|---|
| 99 | }
|
|---|
| 100 | */
|
|---|