root/dmtcpworker.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /****************************************************************************
   2  *   Copyright (C) 2006-2008 by Jason Ansel, Kapil Arya, and Gene Cooperman *
   3  *   jansel@csail.mit.edu, kapil@ccs.neu.edu, gene@ccs.neu.edu              *
   4  *                                                                          *
   5  *  This file is part of DMTCP.                                             *
   6  *                                                                          *
   7  *  DMTCP is free software: you can redistribute it and/or                  *
   8  *  modify it under the terms of the GNU Lesser General Public License as   *
   9  *  published by the Free Software Foundation, either version 3 of the      *
  10  *  License, or (at your option) any later version.                         *
  11  *                                                                          *
  12  *  DMTCP is distributed in the hope that it will be useful,                *
  13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of          *
  14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
  15  *  GNU Lesser General Public License for more details.                     *
  16  *                                                                          *
  17  *  You should have received a copy of the GNU Lesser General Public        *
  18  *  License along with DMTCP:dmtcp/src.  If not, see                        *
  19  *  <http://www.gnu.org/licenses/>.                                         *
  20  ****************************************************************************/
  21 
  22 #ifndef DMTCPDMTCPWORKER_H
  23 #define DMTCPDMTCPWORKER_H
  24 
  25 #include "dmtcpmessagetypes.h"
  26 
  27 void restoreUserLDPRELOAD();
  28 
  29 namespace dmtcp
  30 {
  31   class DmtcpWorker
  32   {
  33     public:
  34 #ifdef JALIB_ALLOCATOR
  35       static void* operator new(size_t nbytes, void* p) { return p; }
  36       static void* operator new(size_t nbytes) { JALLOC_HELPER_NEW(nbytes); }
  37       static void  operator delete(void* p) { JALLOC_HELPER_DELETE(p); }
  38 #endif
  39       DmtcpWorker();
  40       ~DmtcpWorker();
  41       static DmtcpWorker& instance();
  42 
  43       static void waitForCoordinatorMsg(string signalStr,
  44                                         DmtcpMessageType type);
  45       static void informCoordinatorOfRUNNINGState();
  46       static void waitForStage1Suspend();
  47       static void waitForStage2Checkpoint();
  48       static void waitForStage3Refill(bool isRestart);
  49       static void waitForStage4Resume(bool isRestart);
  50       static void restoreVirtualPidTable();
  51       static void postRestart();
  52 
  53       static void resetOnFork();
  54       static void cleanupWorker();
  55 
  56       static int determineCkptSignal();
  57 
  58       static void setExitInProgress() { _exitInProgress = true; };
  59       static bool exitInProgress() { return _exitInProgress; };
  60       static void interruptCkpthread();
  61 
  62       static void writeCheckpointPrefix(int fd);
  63 
  64       static void eventHook(DmtcpEvent_t id, DmtcpEventData_t *data);
  65 
  66     protected:
  67       static void sendUserCommand(char c, int* result = NULL);
  68     private:
  69       static DmtcpWorker theInstance;
  70       static bool _exitInProgress;
  71   };
  72 }
  73 
  74 #endif

/* [<][>][^][v][top][bottom][index][help] */