@@ -1841,6 +1841,8 @@ SK_Unity_SetTargetFrameRate (void)
18411841 static int target_fps;
18421842 target_fps = (int )ceilf (__target_fps_now);
18431843
1844+ static void * params [1 ] = { &target_fps };
1845+
18441846 if (set_targetFrameRate_mono != nullptr && __target_fps_now > 0 .0f )
18451847 {
18461848 SetEvent (hSetTargetFramerateSignal);
@@ -1850,19 +1852,21 @@ SK_Unity_SetTargetFrameRate (void)
18501852 {
18511853 SK_Thread_SetCurrentPriority (THREAD_PRIORITY_LOWEST );
18521854
1853- AttachThread ();
1854-
18551855 while (! ReadAcquire (&__SK_DLL_Ending))
18561856 {
1857- if (WAIT_OBJECT_0 == WaitForMultipleObjects (2 , signals, FALSE , 250 ))
1857+ if (WAIT_OBJECT_0 == WaitForMultipleObjects (2 , signals, FALSE , INFINITE ))
1858+ {
18581859 break ;
1860+ }
1861+
1862+ SK_SleepEx (100UL , FALSE );
18591863
1860- void * params [ 1 ] = { &target_fps } ;
1864+ AttachThread () ;
18611865
18621866 SK_mono_runtime_invoke (set_targetFrameRate_mono, nullptr , params, nullptr );
1863- }
18641867
1865- DetachCurrentThreadIfNotNative ();
1868+ DetachCurrentThreadIfNotNative ();
1869+ }
18661870
18671871 SK_Thread_CloseSelf ();
18681872
@@ -1879,20 +1883,20 @@ SK_Unity_SetTargetFrameRate (void)
18791883 {
18801884 SK_Thread_SetCurrentPriority (THREAD_PRIORITY_LOWEST );
18811885
1882- Il2cpp::thread_attach (Il2cpp::get_domain ());
1883-
18841886 while (! ReadAcquire (&__SK_DLL_Ending))
18851887 {
1886- if (WAIT_OBJECT_0 == WaitForMultipleObjects (2 , signals, FALSE , 250 ))
1888+ if (WAIT_OBJECT_0 == WaitForMultipleObjects (2 , signals, FALSE , INFINITE ))
1889+ {
18871890 break ;
1891+ }
18881892
1889- void * params [ 1 ] = { &target_fps } ;
1893+ SK_SleepEx ( 100UL , FALSE ) ;
18901894
1891- Il2cpp::method_call (set_targetFrameRate_il2cpp, nullptr , params, nullptr );
1895+ Il2cpp::thread_attach (Il2cpp::get_domain ());
1896+ Il2cpp::method_call (set_targetFrameRate_il2cpp, nullptr , params, nullptr );
1897+ Il2cpp::thread_detach (Il2cpp::thread_current ());
18921898 }
18931899
1894- Il2cpp::thread_detach (Il2cpp::thread_current ());
1895-
18961900 SK_Thread_CloseSelf ();
18971901
18981902 return 0 ;
0 commit comments