Windows: Support run in single thread mode.

pull/3255/head
winlin 2 years ago
parent efea38c51a
commit 3d0dcb2a17

@ -163,6 +163,11 @@ if [[ $SRS_LOG_TRACE == YES ]]; then
else
srs_undefine_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_SINGLE_THREAD == YES ]]; then
srs_define_macro "SRS_SINGLE_THREAD" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SINGLE_THREAD" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_LOG_LEVEL_V2 == YES ]]; then
srs_define_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H
else

@ -70,6 +70,7 @@ SRS_BUILD_TAG= # Set the object files tag name.
SRS_CLEAN=YES # Whether do "make clean" when configure.
SRS_SIMULATOR=NO # Whether enable RTC simulate API.
SRS_GENERATE_OBJS=NO # Whether generate objs and quit.
SRS_SINGLE_THREAD=NO # Whether force single thread mode.
#
################################################################
# Performance options.
@ -184,6 +185,7 @@ Experts:
--clean=on|off Whether do 'make clean' when configure. Default: $(value2switch $SRS_CLEAN)
--simulator=on|off RTC: Whether enable network simulator. Default: $(value2switch $SRS_SIMULATOR)
--generate-objs=on|off RTC: Whether generate objs and quit. Default: $(value2switch $SRS_GENERATE_OBJS)
--single-thread=on|off Whether force single thread mode. Default: $(value2switch $SRS_SINGLE_THREAD)
--build-tag=<TAG> Set the build object directory suffix.
Workflow:
@ -298,6 +300,7 @@ function parse_user_option() {
--rtc) SRS_RTC=$(switch2value $value) ;;
--simulator) SRS_SIMULATOR=$(switch2value $value) ;;
--generate-objs) SRS_GENERATE_OBJS=$(switch2value $value) ;;
--single-thread) SRS_SINGLE_THREAD=$(switch2value $value) ;;
--ffmpeg-fit) SRS_FFMPEG_FIT=$(switch2value $value) ;;
--gb28181) SRS_GB28181=$(switch2value $value) ;;
@ -586,6 +589,7 @@ function regenerate_options() {
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug-stats=$(value2switch $SRS_DEBUG_STATS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cross-build=$(value2switch $SRS_CROSS_BUILD)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer=$(value2switch $SRS_SANITIZER)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --single-thread=$(value2switch $SRS_SINGLE_THREAD)"
if [[ $SRS_CROSS_BUILD_ARCH != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --arch=$SRS_CROSS_BUILD_ARCH"; fi
if [[ $SRS_CROSS_BUILD_CPU != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cpu=$SRS_CROSS_BUILD_CPU"; fi
if [[ $SRS_CROSS_BUILD_HOST != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --host=$SRS_CROSS_BUILD_HOST"; fi

@ -475,6 +475,10 @@ srs_error_t run_directly_or_daemon()
srs_error_t run_hybrid_server(void* arg);
srs_error_t run_in_thread_pool()
{
#ifdef SRS_SINGLE_THREAD
srs_trace("Run in single thread mode");
return run_hybrid_server(NULL);
#else
srs_error_t err = srs_success;
// Initialize the thread pool.
@ -490,6 +494,7 @@ srs_error_t run_in_thread_pool()
srs_trace("Pool: Start threads primordial=1, hybrids=1 ok");
return _srs_thread_pool->run();
#endif
}
#include <srs_app_tencentcloud.hpp>

Loading…
Cancel
Save