Skip to content

Commit

Permalink
remove multicast async unused component
Browse files Browse the repository at this point in the history
  • Loading branch information
bha-evs committed May 23, 2024
1 parent ddcabb0 commit 8918c46
Show file tree
Hide file tree
Showing 46 changed files with 55 additions and 274 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# Revision: 5.0
#
# History: 05 June 2004: BHA: Initial version

#git clone https://github.com/onbings/bofstd.git

#compile with emscripten:
#cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/pro/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_TOOLCHAIN_FILE=C:/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=wasm32-emscripten -DBUILD_SHARED_LIBS=OFF -DRHEL:STRING="el9" -DCMAKE_GENERATOR=Ninja -DCMAKE_BUILD_TYPE=Debug -SC:/pro/github/bofstd -BC:/bld/bofstd-web -DCMAKE_CROSSCOMPILING_EMULATOR=C:/pro/emsdk/node/16.20.0_64bit/bin/node.exe -G Ninja
#cmake -DCMAKE_INSTALL_PREFIX=/home/bha/bld/bofstd-web/binaries -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/bha/pro/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_TOOLCHAIN_FILE=/home/bha/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=wasm32-emscripten -DBUILD_SHARED_LIBS=OFF -DRHEL:STRING="el9" -DCMAKE_BUILD_TYPE=Debug -S/home/bha/pro/evs-xts -B/home/bha/bld/bofstd-web -DCMAKE_CROSSCOMPILING_EMULATOR=/home/bha/pro/emsdk/node/16.20.0_64bit/bin/node -G Ninja
Expand Down Expand Up @@ -44,7 +47,7 @@ include(cmake/fetch_content.cmake)
# in code coverage computation as they are test programs themselves.
set(EXTRA_COVERAGE_EXCLUSION "\'${CMAKE_CURRENT_SOURCE_DIR}/integration/*\'")

project(bofstd VERSION 5.5.4.4)
project(bofstd VERSION 5.6.0.1)

if (EMSCRIPTEN)
message("Force pthread detection for BofStd compilation under EMSCRIPTEN")
Expand Down
86 changes: 43 additions & 43 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,42 +93,42 @@ set(DB_FILES
include/bofstd/boframdb.h
)

set(DELEGATE_FILES
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/bofmsgthread.h
third/AsyncMulticastDelegate/src/bofmsgthread.cpp

third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Allocator.h
third/AsyncMulticastDelegate/src/Allocator.cpp
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateAsync.h
third/AsyncMulticastDelegate/src/DelegateAsync.cpp
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateInvoker.h
third/AsyncMulticastDelegate/src/DelegateRemoteInvoker.cpp
third/AsyncMulticastDelegate/src/MulticastDelegateBase.cpp
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/LockGuard.h
third/AsyncMulticastDelegate/src/LockGuard.cpp
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/xallocator.h
third/AsyncMulticastDelegate/src/xallocator.cpp
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Semaphore.h
third/AsyncMulticastDelegate/src/Semaphore.cpp

third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Delegate.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateAsyncWait.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateLib.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateMsg.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateOpt.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteInvoker.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteRecv.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteSend.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateSp.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateSpAsync.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateThread.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateTransport.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegate.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegateBase.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegateSafe.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/SinglecastDelegate.h
third/AsyncMulticastDelegate/include/asyncmulticastdelegate/ThreadMsg.h
)
#set(DELEGATE_FILES
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/bofmsgthread.h
# third/AsyncMulticastDelegate/src/bofmsgthread.cpp
#
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Allocator.h
# third/AsyncMulticastDelegate/src/Allocator.cpp
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateAsync.h
# third/AsyncMulticastDelegate/src/DelegateAsync.cpp
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateInvoker.h
# third/AsyncMulticastDelegate/src/DelegateRemoteInvoker.cpp
# third/AsyncMulticastDelegate/src/MulticastDelegateBase.cpp
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/LockGuard.h
# third/AsyncMulticastDelegate/src/LockGuard.cpp
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/xallocator.h
# third/AsyncMulticastDelegate/src/xallocator.cpp
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Semaphore.h
# third/AsyncMulticastDelegate/src/Semaphore.cpp
#
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/Delegate.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateAsyncWait.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateLib.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateMsg.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateOpt.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteInvoker.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteRecv.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateRemoteSend.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateSp.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateSpAsync.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateThread.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/DelegateTransport.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegate.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegateBase.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/MulticastDelegateSafe.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/SinglecastDelegate.h
# third/AsyncMulticastDelegate/include/asyncmulticastdelegate/ThreadMsg.h
#)

set(ENUM_FLAG_FILES
include/bofstd/bofflag.h
Expand Down Expand Up @@ -259,7 +259,7 @@ set(SOURCES_FILES
${CRYPTO_FILES}
${DAEMON_FILES}
${DB_FILES}
${DELEGATE_FILES}
#${DELEGATE_FILES}
${ENUM_FLAG_FILES}
${FS_FILES}
${IXML_FILES}
Expand All @@ -286,7 +286,7 @@ source_group("Container" FILES ${CONTAINER_FILES})
source_group("Crypto" FILES ${CRYPTO_FILES})
source_group("Daemon" FILES ${DAEMON_FILES})
source_group("Db" FILES ${DB_FILES})
source_group("Delegate" FILES ${DELEGATE_FILES})
#source_group("Delegate" FILES ${DELEGATE_FILES})
source_group("EnumFlag" FILES ${ENUM_FLAG_FILES})
source_group("Fs" FILES ${FS_FILES})
source_group("Xml" FILES ${IXML_FILES})
Expand Down Expand Up @@ -328,7 +328,7 @@ target_include_directories(bofstd
#Header path used at build time
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/cpp-linenoise-master>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/AsyncMulticastDelegate/include>
#$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/AsyncMulticastDelegate/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/ixml/inc>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/ixml/src/inc>
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third/vld/include>
Expand Down Expand Up @@ -487,10 +487,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bofstd_export.h
# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bofstd/vld
# COMPONENT bofstd-devel
#)
install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/third/AsyncMulticastDelegate/include/asyncmulticastdelegate/.
DESTINATION include/asyncmulticastdelegate
COMPONENT bofstd-devel
)
#install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/third/AsyncMulticastDelegate/include/asyncmulticastdelegate/.
# DESTINATION include/asyncmulticastdelegate
# COMPONENT bofstd-devel
#)
# install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/third/libyuv/include/.
# DESTINATION include/libyuv
# COMPONENT bofstd-devel
Expand Down
224 changes: 1 addition & 223 deletions lib/include/bofstd/bofasync.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* V 1.00 May 26 2020 BHA : Initial release
*/
#pragma once

#include <asyncmulticastdelegate/DelegateLib.h>
#include <bofstd/bofthread.h>
#include <bofstd/bofcircularbuffer.h>

BEGIN_BOF_NAMESPACE()
Expand Down Expand Up @@ -87,225 +86,4 @@ class BOFSTD_EXPORT BofCommandQueue : public BofThread
BOFERR V_OnProcessing() override;
};

template <class T>
using BOF_MULTICAST_ASYNC_NOTIFY_FCT = void (*)(const T *_pNotifyArg);
// typedef void (*BOF_MULTICAST_ASYNC_NOTIFY_FCT)(const BOF_MULTICAST_ASYNC_NOTIFY_ARG *_pNotifyArg_X);

struct BOF_MULTICAST_ASYNC_NOTIFIER_PARAM
{
bool PriorityInversionAware_B;
uint64_t ThreadCpuCoreAffinityMask_U64;
BOF_THREAD_SCHEDULER_POLICY ThreadSchedulerPolicy_E;
BOF_THREAD_PRIORITY ThreadPriority_E;
// uint32_t MaxPendingRequest_U32; //0 means no limit

BOF_MULTICAST_ASYNC_NOTIFIER_PARAM()
{
Reset();
}
void Reset()
{
PriorityInversionAware_B = false;
ThreadCpuCoreAffinityMask_U64 = 0;
ThreadSchedulerPolicy_E = BOF_THREAD_SCHEDULER_POLICY_OTHER;
ThreadPriority_E = BOF_THREAD_PRIORITY_000;
// MaxPendingRequest_U32 = 0;
}
};

template <class T>
class BofMulticastAsyncNotifier
{
public:
BofMulticastAsyncNotifier(const BOF_MULTICAST_ASYNC_NOTIFIER_PARAM &_rAsyncNotifierParam_X);
virtual ~BofMulticastAsyncNotifier();
uint32_t NbPendingNotification();

// BOFERR Register(BOF_MULTICAST_ASYNC_NOTIFY_FCT _pNotifyFct);
// BOFERR Unregister(BOF_MULTICAST_ASYNC_NOTIFY_FCT _pNotifyFct);
BOFERR Register(BOF_MULTICAST_ASYNC_NOTIFY_FCT<T> _pNotifyFct, void *_pUserContext);
BOFERR Unregister(BOF_MULTICAST_ASYNC_NOTIFY_FCT<T> _pNotifyFct);
BOFERR Notify(const T *_pNotifyArg_X);
BOFERR WaitForNoMoreNotificationPending(uint32_t _PollTimeInMs_U32, uint32_t _TimeoutInMs_U32);

private:
std::unique_ptr<BofMsgThread> mpuMsgThread=nullptr;
DelegateLib::MulticastDelegateSafe1<const T *> mMulticastDelegate;
};

template <class T>
BofMulticastAsyncNotifier<T>::BofMulticastAsyncNotifier(const BOF_MULTICAST_ASYNC_NOTIFIER_PARAM &_rAsyncNotifierParam_X)
{
BOFERR Sts_E;

mpuMsgThread = std::make_unique<BofMsgThread>(_rAsyncNotifierParam_X.PriorityInversionAware_B);
Sts_E = mpuMsgThread->LaunchBofProcessingThread("BofAsyncNotif", _rAsyncNotifierParam_X.PriorityInversionAware_B, false, 0, _rAsyncNotifierParam_X.ThreadSchedulerPolicy_E, _rAsyncNotifierParam_X.ThreadPriority_E, _rAsyncNotifierParam_X.ThreadCpuCoreAffinityMask_U64, 2000, 0);
BOF_ASSERT(Sts_E == BOF_ERR_NO_ERROR);
}
template <class T>
BofMulticastAsyncNotifier<T>::~BofMulticastAsyncNotifier()
{
mMulticastDelegate.Clear();
}
template <class T>
uint32_t BofMulticastAsyncNotifier<T>::NbPendingNotification()
{
return mpuMsgThread->GetNbPendingRequest();
}

template <class T>
BOFERR BofMulticastAsyncNotifier<T>::Register(BOF_MULTICAST_ASYNC_NOTIFY_FCT<T> _pNotifyFct, void *_pUserContext)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyFct)
{
Rts_E = BOF_ERR_NO_ERROR;
auto Delegate = MakeDelegate(_pNotifyFct, mpuMsgThread.get());
Delegate.UserContext(_pUserContext);
mMulticastDelegate += Delegate;
}
return Rts_E;
}
template <class T>
BOFERR BofMulticastAsyncNotifier<T>::Unregister(BOF_MULTICAST_ASYNC_NOTIFY_FCT<T> _pNotifyFct)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyFct)
{
Rts_E = BOF_ERR_NO_ERROR;
mMulticastDelegate -= MakeDelegate(_pNotifyFct, mpuMsgThread.get());
}
return Rts_E;
}
template <class T>
BOFERR BofMulticastAsyncNotifier<T>::Notify(const T *_pNotifyArg)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyArg)
{
Rts_E = BOF_ERR_EMPTY;
if (!mMulticastDelegate.Empty())
{
Rts_E = BOF_ERR_NO_ERROR;
mMulticastDelegate(_pNotifyArg);
}
}
return Rts_E;
}
template <class T>
BOFERR BofMulticastAsyncNotifier<T>::WaitForNoMoreNotificationPending(uint32_t _PollTimeInMs_U32, uint32_t _TimeoutInMs_U32)
{
BOFERR Rts_E = BOF_ERR_INIT;
uint32_t StartInMs_U32, DeltaInMs_U32;

Rts_E = BOF_ERR_EINVAL;
if (_PollTimeInMs_U32 <= _TimeoutInMs_U32)
{
StartInMs_U32 = BOF::Bof_GetMsTickCount();
Rts_E = BOF_ERR_FULL;
do
{
if (mpuMsgThread->GetNbPendingRequest() == 0)
{
Rts_E = BOF_ERR_NO_ERROR;
break;
// StartInMs_U32 = BOF::Bof_GetMsTickCount();
}

BOF::Bof_MsSleep(_PollTimeInMs_U32);
DeltaInMs_U32 = BOF::Bof_ElapsedMsTime(StartInMs_U32);
} while (DeltaInMs_U32 < _TimeoutInMs_U32);
}
return Rts_E;
}

template <class T>
using BOF_MULTICAST_SYNC_NOTIFY_FCT = void (*)(const T *_pNotifyArg);

struct BOF_MULTICAST_SYNC_NOTIFIER_PARAM
{
uint32_t Dummy_U32;

BOF_MULTICAST_SYNC_NOTIFIER_PARAM()
{
Reset();
}
void Reset()
{
Dummy_U32 = 0;
}
};

template <class T>
class BofMulticastSyncNotifier
{
public:
BofMulticastSyncNotifier(const BOF_MULTICAST_SYNC_NOTIFIER_PARAM &_rSyncNotifierParam_X);
virtual ~BofMulticastSyncNotifier();

BOFERR Register(BOF_MULTICAST_SYNC_NOTIFY_FCT<T> _pNotifyFct, void *_pUserContext);
BOFERR Unregister(BOF_MULTICAST_SYNC_NOTIFY_FCT<T> _pNotifyFct);
BOFERR Notify(const T *_pNotifyArg_X);

private:
DelegateLib::MulticastDelegateSafe1<const T *> mMulticastDelegate;
};

template <class T>
BofMulticastSyncNotifier<T>::BofMulticastSyncNotifier(const BOF_MULTICAST_SYNC_NOTIFIER_PARAM &_rSyncNotifierParam_X)
{
}
template <class T>
BofMulticastSyncNotifier<T>::~BofMulticastSyncNotifier()
{
mMulticastDelegate.Clear();
}

template <class T>
BOFERR BofMulticastSyncNotifier<T>::Register(BOF_MULTICAST_SYNC_NOTIFY_FCT<T> _pNotifyFct, void *_pUserContext)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyFct)
{
Rts_E = BOF_ERR_NO_ERROR;
auto Delegate = DelegateLib::MakeDelegate(_pNotifyFct);
;
Delegate.UserContext(_pUserContext);
mMulticastDelegate += Delegate;
}
return Rts_E;
}
template <class T>
BOFERR BofMulticastSyncNotifier<T>::Unregister(BOF_MULTICAST_SYNC_NOTIFY_FCT<T> _pNotifyFct)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyFct)
{
Rts_E = BOF_ERR_NO_ERROR;
mMulticastDelegate -= DelegateLib::MakeDelegate(_pNotifyFct);
}
return Rts_E;
}
template <class T>
BOFERR BofMulticastSyncNotifier<T>::Notify(const T *_pNotifyArg)
{
BOFERR Rts_E = BOF_ERR_EINVAL;

if (_pNotifyArg)
{
Rts_E = BOF_ERR_EMPTY;
if (!mMulticastDelegate.Empty())
{
Rts_E = BOF_ERR_NO_ERROR;
mMulticastDelegate(_pNotifyArg);
}
}
return Rts_E;
}

END_BOF_NAMESPACE()
2 changes: 2 additions & 0 deletions lib/include/bofstd/bofaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* V 1.00 Apr 11 2024 BHA : Initial release
*/
#pragma once
#define _USE_MATH_DEFINES // https://stackoverflow.com/questions/26065359/m-pi-flagged-as-undeclared-identifier
#include <cmath>
#include <string>
#include <vector>
#include <functional>
Expand Down
2 changes: 0 additions & 2 deletions lib/src/bofasync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*
* V 1.00 May 26 2020 BHA : Initial release
*/
#include <asyncmulticastdelegate/DelegateLib.h>
#include <asyncmulticastdelegate/bofmsgthread.h>
#include <bofstd/bofasync.h>

BEGIN_BOF_NAMESPACE()
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8918c46

Please sign in to comment.