diff --git a/libs/core/include/boost/core/detail/sp_thread_sleep.hpp b/libs/core/include/boost/core/detail/sp_thread_sleep.hpp
index f461c3fd1ea71ffe201d23143add55bd36c7ec68..1b0297b7e8b3ed0982fd9311e506fcbf3365000d 100644
--- a/libs/core/include/boost/core/detail/sp_thread_sleep.hpp
+++ b/libs/core/include/boost/core/detail/sp_thread_sleep.hpp
@@ -56,7 +56,8 @@ using boost::core::detail::sp_thread_sleep;
 
 #include <time.h>
 
-#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
+// OHOS musl, like Android bionic, does not provide pthread_setcancelstate
+#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) && !defined(__OHOS__)
 # include <pthread.h>
 #endif
 
@@ -67,7 +68,7 @@ namespace core
 
 inline void sp_thread_sleep() BOOST_NOEXCEPT
 {
-#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
+#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) && !defined(__OHOS__)
 
     int oldst;
     pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldst );
@@ -85,7 +86,7 @@ inline void sp_thread_sleep() BOOST_NOEXCEPT
 
     nanosleep( &rqtp, 0 );
 
-#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
+#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) && !defined(__OHOS__)
 
     pthread_setcancelstate( oldst, &oldst );