1 /* Copyright (C) 2014 InfiniDB, Inc. 2 3 This program is free software; you can redistribute it and/or 4 modify it under the terms of the GNU General Public License 5 as published by the Free Software Foundation; version 2 of 6 the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. */ 17 18 /******************************************************************************* 19 * $Id: we_bulkstatus.h 4648 2013-05-29 21:42:40Z rdempsey $ 20 * 21 *******************************************************************************/ 22 /** @file */ 23 24 #ifndef _WE_BULKSTATUS_H_ 25 #define _WE_BULKSTATUS_H_ 26 27 #if 0 //defined(_MSC_VER) && defined(WE_BULKSTATUS_DLLEXPORT) 28 #define EXPORT __declspec(dllexport) 29 #else 30 #define EXPORT 31 #endif 32 33 namespace WriteEngine 34 { 35 36 // Defined this class to hold the global JobStatus flag rather then storing in 37 // BulkLoad, because that would introduce circular dependencies, with the other 38 // classes needing BulkLoad. So put the JobStatus in a separate class. 39 class BulkStatus 40 { 41 public: getJobStatus()42 static int getJobStatus() 43 { 44 return fJobStatus; 45 } setJobStatus(int jobStatus)46 static void setJobStatus(int jobStatus) 47 { 48 fJobStatus = jobStatus; 49 } 50 51 private: 52 /* @brief Global job status flag. 53 * Declared volatile to insure that all threads see when this flag is 54 * changed. We don't worry about using a mutex since we are just using 55 * as a flag. Making the variable volatile should suffice, to make it 56 * work with multiple threads. 57 */ 58 static volatile int fJobStatus; 59 }; 60 61 } // end of namespace 62 63 #undef EXPORT 64 65 #endif // _WE_BULKSTATUS_H_ 66