From 947c78887e791596d4a5ec2d1079f8b1a049628b Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Tue, 27 Oct 2020 11:16:21 +0900 Subject: basesystem 0.1 --- .../library/src/_pbCSection.cpp | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 vehicleservice/positioning_base_library/library/src/_pbCSection.cpp (limited to 'vehicleservice/positioning_base_library/library/src/_pbCSection.cpp') diff --git a/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp b/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp new file mode 100644 index 00000000..e144d6fe --- /dev/null +++ b/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp @@ -0,0 +1,131 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/******************************************************************************* +* $Header:: $ +* $Revision:: $ +*******************************************************************************/ + +/**************************************************************************** + * File name :_pbCSection.cpp + * System name :GPF + * Subsystem name :_CWORD64_API Critical Section Function + * Title :Critical Section Function Definition File + ****************************************************************************/ + +#include +#include +#include +#include "WPF_STD_private.h" +#include "_pbInternalProc.h" + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* MODULE : PbDeleteCriticalSection() +* ABSTRACT : Specify a critical section object that is not owned and free all resources used by that object. +* NOTE : +* ARGUMENT : LPCRITICAL_SECTION lp_critical_section +* RETURN : VOID defined +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + int32 lret = EOK; + + if (lp_critical_section == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbDeleteCriticalSection\r\n", + LTEXT(__FILE__), __LINE__); + } else { + lret = pthread_mutex_destroy(lp_critical_section); + if (lret != EOK) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbDeleteCriticalSection\r\n", + LTEXT(__FILE__), __LINE__, lret); + } + } + + return; +} +// LCOV_EXCL_STOP + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* MODULE : PbEnterCriticalSection() +* ABSTRACT : Wait to take ownership of the specified critical section object +* NOTE : +* ARGUMENT : LPCRITICAL_SECTION lp_critical_section +* RETURN : VOID defined +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + int32 lret = EOK; + + if (lp_critical_section == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbEnterCriticalSection\r\n", + LTEXT(__FILE__), __LINE__); + } else { + lret = pthread_mutex_lock(lp_critical_section); + if (lret != EOK) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbEnterCriticalSection\r\n", + LTEXT(__FILE__), __LINE__, lret); + } + } + + return; +} +// LCOV_EXCL_STOP + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* MODULE : PbInitializeCriticalSection +* ABSTRACT : Initialize the specified critical section object. +* NOTE : +* ARGUMENT : LPCRITICAL_SECTION lp_critical_section +* RETURN : VOID defined +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert +} +// LCOV_EXCL_STOP + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* MODULE : PbLeaveCriticalSection +* ABSTRACT : Discard ownership of the specified critical section object. +* NOTE : +* ARGUMENT : LPCRITICAL_SECTION lp_critical_section +* RETURN : VOID defined +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section ) { // LCOV_EXCL_START 8:dead code + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + int32 lret = EOK; + + if (lp_critical_section == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbLeaveCriticalSection\r\n", + LTEXT(__FILE__), __LINE__); + } else { + lret = pthread_mutex_unlock(lp_critical_section); + if (lret != EOK) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbLeaveCriticalSection\r\n", + LTEXT(__FILE__), __LINE__, lret); + } + } + + return; +} +// LCOV_EXCL_STOP + -- cgit 1.2.3-korg