forked from boostorg/core
Add boost/core/yield_primitives.hpp
This commit is contained in:
@@ -386,5 +386,10 @@ run serialization_construct_data_test.cpp : : : <library>/boost//serialization/<
|
||||
run identity_test.cpp ;
|
||||
run identity_rvalue_test.cpp ;
|
||||
|
||||
run sp_thread_pause_test.cpp ;
|
||||
run sp_thread_yield_test.cpp ;
|
||||
run sp_thread_sleep_test.cpp ;
|
||||
run yield_prim_windows_h_test.cpp ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Test for sp_thread_pause
|
||||
//
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/yield_primitives.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
for( int i = 0; i < 1048576; ++i )
|
||||
{
|
||||
boost::core::sp_thread_pause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Test for sp_thread_sleep
|
||||
//
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/yield_primitives.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
for( int i = 0; i < 1000; ++i )
|
||||
{
|
||||
boost::core::sp_thread_sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Test for sp_thread_yield
|
||||
//
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/yield_primitives.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
for( int i = 0; i < 10000; ++i )
|
||||
{
|
||||
boost::core::sp_thread_yield();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Test for sp_thread_yield
|
||||
//
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <boost/core/yield_primitives.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::core::sp_thread_pause();
|
||||
boost::core::sp_thread_yield();
|
||||
boost::core::sp_thread_sleep();
|
||||
}
|
||||
Reference in New Issue
Block a user