1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef RELIABILITY_XCOLLIE_CHECKER_H 17 #define RELIABILITY_XCOLLIE_CHECKER_H 18 19 #include <thread> 20 #include <mutex> 21 #include <string> 22 #include <map> 23 #include <singleton.h> 24 #include <refbase.h> 25 26 namespace OHOS { 27 namespace HiviewDFX { 28 class XCollieChecker : public virtual RefBase { 29 public: XCollieChecker(const std::string & serviceName)30 XCollieChecker(const std::string &serviceName):checkerName_(serviceName), complete_(false) 31 { 32 }; ~XCollieChecker()33 virtual ~XCollieChecker() 34 { 35 }; CheckLock()36 virtual void CheckLock() 37 { 38 return; 39 }; CheckThreadBlock()40 virtual void CheckThreadBlock() 41 { 42 return; 43 }; SetThreadBlockResult(bool complete)44 void SetThreadBlockResult(bool complete) 45 { 46 complete_ = complete; 47 } GetThreadBlockResult()48 virtual bool GetThreadBlockResult() 49 { 50 return complete_; 51 } GetCheckerName()52 const std::string GetCheckerName() 53 { 54 return checkerName_; 55 } 56 private: 57 std::string checkerName_; 58 bool complete_; 59 }; 60 } // end of namespace HiviewDFX 61 } // end of namespace OHOS 62 #endif 63 64