Skip to content

Commit

Permalink
Merge pull request #1329 from fspindle/feat_remove_pthread
Browse files Browse the repository at this point in the history
Introduce std::thread and std::mutex usage instead of pthread
  • Loading branch information
fspindle authored Feb 8, 2024
2 parents 5567e30 + 0386188 commit 0a5d4cf
Show file tree
Hide file tree
Showing 239 changed files with 925 additions and 2,823 deletions.
22 changes: 21 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,27 @@
"stop_token": "cpp",
"view": "cpp",
"mixinvector": "cpp",
"charconv": "cpp"
"charconv": "cpp",
"coroutine": "cpp",
"resumable": "cpp",
"format": "cpp",
"ranges": "cpp",
"span": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
},
"C_Cpp.vcFormat.indent.namespaceContents": false,
"editor.formatOnSave": true,
Expand Down
Empty file modified 3rdparty/simdlib/Simd/SimdAlignment.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAllocator.hpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdArray.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx1.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx1Cpu.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx1Resizer.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2BgrToBgra.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2BgrToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2BgrToRgb.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2BgraToBgr.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2BgraToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2Cpu.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2Deinterleave.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2GaussianBlur.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2Reduce.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2ReduceGray2x2.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2ReduceGray3x3.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2ReduceGray4x4.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2ReduceGray5x5.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2ResizeBilinear.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdAvx2Resizer.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBase.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseBgrToBgra.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseBgrToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseBgrToRgb.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseBgraToBgr.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseBgraToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseCpu.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseDeinterleave.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseGaussianBlur.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdBaseResizer.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdConfig.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdConst.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdConversion.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdCopyPixel.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdCpu.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdDefs.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdEnable.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdExp.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdExtract.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdFrame.hpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdInit.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLib.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLib.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLib.hpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLoad.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLoadBlock.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdLog.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdMath.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdMemory.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeon.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonBgrToBgra.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonBgrToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonBgrToRgb.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonBgraToBgr.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonBgraToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonDeinterleave.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonGaussianBlur.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdNeonResizer.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdPixel.hpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdPow.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdResizer.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdResizerCommon.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdRuntime.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSet.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41BgrToBgra.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41BgrToGray.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41BgrToRgb.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41BgraToBgr.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41Cpu.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41GaussianBlur.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41GrayToBgr.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41Reduce.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41ReduceGray2x2.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41ReduceGray4x4.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41ResizeBilinear.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdSse41Resizer.cpp
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdStore.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdStream.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdUpdate.h
100755 → 100644
Empty file.
Empty file modified 3rdparty/simdlib/Simd/SimdView.hpp
100755 → 100644
Empty file.
37 changes: 20 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -586,17 +586,8 @@ if(SOQT_FOUND) # SoQt < 1.6.0 that depends on Qt4 was found. We need an explicit
VP_OPTION(USE_QT Qt "" "Include Coin/SoQt/Qt support" "" ON IF USE_SOQT AND NOT WINRT AND NOT IOS)
endif()
VP_OPTION(USE_SOXT SOXT "" "Include Coin/SoXt support" "" OFF IF USE_COIN3D AND NOT WINRT AND NOT IOS)
set(THREADS_PREFER_PTHREAD_FLAG ON)
VP_OPTION(USE_THREADS Threads "" "Include std::thread support" "" ON IF NOT (WIN32 OR MINGW))

# We need threads. To be changed to make threads optional
if(NOT USE_THREADS)
if(Threads_FOUND)
message(WARNING "We need std::thread. We turn USE_THREADS=ON.")
unset(USE_THREADS)
set(USE_THREADS ON CACHE BOOL "Include std::thread support" FORCE)
endif()
endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
VP_OPTION(USE_THREADS Threads "" "Include std::thread support" "" ON)

VP_OPTION(USE_XML2 XML2 "" "Include libxml2 support" "" ON IF NOT WINRT)
if(CMAKE_TOOLCHAIN_FILE)
Expand All @@ -613,7 +604,7 @@ VP_OPTION(USE_X11 X11 "" "Include X11 support" "${X1
VP_OPTION(USE_GTK2 MyGTK2 "" "Include gtk2 support" "" OFF IF NOT WINRT AND NOT IOS)
VP_OPTION(USE_JPEG "JPEG;MyJPEG" "" "Include jpeg support" "" ON IF NOT IOS)
VP_OPTION(USE_PNG "PNG;MyPNG" "" "Include png support" "" ON IF NOT IOS)
# To control Pioneer mobile robots, under UNIX we need Aria, pthread, rt and dl 3rd party libraries
# To control Pioneer mobile robots, under UNIX we need Aria and std::threads, rt and dl 3rd party libraries
VP_OPTION(USE_ARIA ARIA "" "Include aria support" "" ON IF NOT WINRT AND NOT IOS)
#VP_OPTION(USE_RT RT "" "Include rt support" "" ON)
#VP_OPTION(USE_DL DL "" "Include dl support" "" ON)
Expand All @@ -624,7 +615,6 @@ VP_OPTION(USE_PCL PCL QUIET "Include Point Cloud Library suppor
VP_OPTION(USE_TENSORRT TensorRT "" "Include TensorRT support" "" ON IF NOT WINRT AND NOT IOS)
VP_OPTION(USE_NLOHMANN_JSON nlohmann_json QUIET "Include nlohmann json support" "" ON)

# Upgrade c++ standard to 14 for pcl 1.9.1.99 that enables by default c++ 14 standard
if(USE_PCL)
# PCL is used in modules gui, sensor and mbt.
# In these modules we cannot directly use PCL_INCLUDE_DIRS and PCL_LIBRARIES using:
Expand Down Expand Up @@ -700,14 +690,23 @@ if(VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_11)
unset(USE_ARSDK)
set(USE_ARSDK OFF CACHE BOOL "Include Parrot ARSDK support" FORCE)
endif()
if(USE_THREADS)
message(WARNING "std::thread was detected but needs at least c++11 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable std::thread usage turning USE_THREADS=OFF.")
unset(USE_THREADS)
set(USE_THREADS OFF CACHE BOOL "Include std::thread support" FORCE)
elseif(UNIX)
# Apriltag on unix needs pthread. On windows we are using pthread built-in
if(Threads_FOUND)
set(USE_PTHREAD ON) # for AprilTag only
endif()
endif()
endif()

# ----------------------------------------------------------------------------
# Build-in 3rd parties. Should be after c++ standard potential modification
# ----------------------------------------------------------------------------
VP_OPTION(WITH_PTHREAD "" "" "Build pthread as built-in library" "" ON IF (NOT USE_THREADS) AND (WIN32 OR MINGW) AND (NOT WINRT))
VP_OPTION(WITH_PTHREAD "" "" "Build pthread as built-in library" "" ON IF (WIN32 OR MINGW) AND (NOT WINRT))
# Since C99 is not supported by MSVC 2010 or prior, we disable apriltag if MSVC < 2012
VP_OPTION(WITH_APRILTAG "" "" "Build AprilTag as built-in library" "" ON IF (USE_THREADS OR WITH_PTHREAD) AND (NOT WINRT) AND (NOT MSVC_VERSION LESS 1700))
VP_OPTION(WITH_APRILTAG "" "" "Build AprilTag as built-in library" "" ON IF (USE_THREADS OR USE_PTHREAD OR WITH_PTHREAD) AND (NOT WINRT) AND (NOT MSVC_VERSION LESS 1700))
VP_OPTION(WITH_APRILTAG_BIG_FAMILY "" "" "Build AprilTag big family (41h12, 48h12, 49h12, 52h13)" "" OFF IF WITH_APRILTAG)
VP_OPTION(WITH_ATIDAQ "" "" "Build atidaq-c as built-in library" "" ON IF USE_COMEDI AND NOT WINRT)
VP_OPTION(WITH_CLIPPER "" "" "Build clipper as built-in library" "" ON IF USE_OPENCV)
Expand Down Expand Up @@ -996,7 +995,10 @@ VP_SET(VISP_HAVE_LAPACK_GSL TRUE IF (BUILD_MODULE_visp_core AND USE_GSL))
VP_SET(VISP_HAVE_LAPACK_MKL TRUE IF (BUILD_MODULE_visp_core AND USE_MKL))
VP_SET(VISP_HAVE_LAPACK_NETLIB TRUE IF (BUILD_MODULE_visp_core AND USE_NETLIB))
VP_SET(VISP_HAVE_LAPACK_OPENBLAS TRUE IF (BUILD_MODULE_visp_core AND USE_OPENBLAS))
VP_SET(VISP_HAVE_PTHREAD TRUE IF (BUILD_MODULE_visp_core AND USE_THREADS)) # Keep for the momment for compat

# Keep VISP_HAVE_PTHREAD for the moment for compat and for vpMutex and vpThread deprecated classes
VP_SET(VISP_HAVE_PTHREAD TRUE IF (BUILD_MODULE_visp_core AND (USE_PTHREAD AND UNIX)))

VP_SET(VISP_HAVE_THREADS TRUE IF (BUILD_MODULE_visp_core AND USE_THREADS))
VP_SET(VISP_HAVE_XML2 TRUE IF (BUILD_MODULE_visp_core AND USE_XML2))
VP_SET(VISP_HAVE_PCL TRUE IF (BUILD_MODULE_visp_core AND USE_PCL))
Expand Down Expand Up @@ -1730,6 +1732,7 @@ status("")
status(" Optimization: ")
status(" Use OpenMP:" USE_OPENMP THEN "yes" ELSE "no")
status(" Use std::thread:" USE_THREADS THEN "yes" ELSE "no")
status(" Use pthread:" USE_PHREADS THEN "yes" ELSE "no")
status(" Use pthread (built-in):" WITH_PTHREAD THEN "yes (ver ${PTHREADS_VERSION})" ELSE "no")
status(" Use simdlib (built-in):" WITH_SIMDLIB THEN "yes" ELSE "no")
status("")
Expand Down
Empty file modified apps/calibration/hand_eye_calibration_show_extrinsics.py
100755 → 100644
Empty file.
Empty file modified cmake/templates/visp-config.bat.in
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion cmake/templates/vpConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
// Defined if XML2 library available.
#cmakedefine VISP_HAVE_XML2

// Defined if pthread library available.
// Defined if pthread library available (deprecated).
#cmakedefine VISP_HAVE_PTHREAD

// Defined if std::thread available.
Expand Down
Empty file modified doc/image/tutorial/started/img-monkey-win.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/image/tutorial/visual-servo/img-bebop2-coord-system.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified example/calibration/camera_calibration_show_extrinsics.py
100755 → 100644
Empty file.
2 changes: 0 additions & 2 deletions example/device/framegrabber/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ set(example_cpp
grabDirectShow.cpp
grabDirectShowMulti.cpp
grabFlyCapture.cpp
grabRealSense.cpp
grabRealSense2.cpp
grabRealSense2_T265.cpp
grabV4l2MultiCpp11Thread.cpp
Expand Down Expand Up @@ -83,7 +82,6 @@ if(VISP_HAVE_REALSENSE OR VISP_HAVE_REALSENSE2)
list(APPEND CXX_FLAGS_MUTE_WARNINGS "-Wno-unqualified-std-cast-call")

visp_set_source_file_compile_flag(getRealSense2Info.cpp ${CXX_FLAGS_MUTE_WARNINGS})
visp_set_source_file_compile_flag(grabRealSense.cpp ${CXX_FLAGS_MUTE_WARNINGS})
visp_set_source_file_compile_flag(grabRealSense2.cpp ${CXX_FLAGS_MUTE_WARNINGS})
visp_set_source_file_compile_flag(grabRealSense2_T265.cpp ${CXX_FLAGS_MUTE_WARNINGS})
visp_set_source_file_compile_flag(readRealSenseData.cpp ${CXX_FLAGS_MUTE_WARNINGS})
Expand Down
259 changes: 0 additions & 259 deletions example/device/framegrabber/grabRealSense.cpp

This file was deleted.

Loading

0 comments on commit 0a5d4cf

Please sign in to comment.