Browse Source

Fixed thread registration issue.

woollybah 5 năm trước cách đây
mục cha
commit
7c4881449b

+ 1 - 1
steamsdk.mod/common.bmx

@@ -1,4 +1,4 @@
-' Copyright (c) 2019 Bruce A Henderson
+' Copyright (c) 2019-2020 Bruce A Henderson
 ' 
 ' 
 ' This software is provided 'as-is', without any express or implied
 ' This software is provided 'as-is', without any express or implied
 ' warranty. In no event will the authors be held liable for any damages
 ' warranty. In no event will the authors be held liable for any damages

+ 12 - 4
steamsdk.mod/glue/glue.cpp

@@ -1,5 +1,5 @@
 /*
 /*
-  Copyright (c) 2019 Bruce A Henderson
+  Copyright (c) 2019-2020 Bruce A Henderson
   
   
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty. In no event will the authors be held liable for any damages
   warranty. In no event will the authors be held liable for any damages
@@ -367,6 +367,7 @@ class CallbackTimer
 {
 {
     std::thread th;
     std::thread th;
     bool running = false;
     bool running = false;
+	BBThread * bbThread = NULL;
 
 
 public:
 public:
     typedef std::chrono::milliseconds Interval;
     typedef std::chrono::milliseconds Interval;
@@ -376,13 +377,20 @@ public:
         running = true;
         running = true;
 
 
         th = std::thread([=]() {
         th = std::thread([=]() {
-			struct GC_stack_base base;;
-			GC_get_stack_base(&base);
-			GC_register_my_thread(&base);
+
+#ifdef _WIN32
+			auto nativeThread = ::GetCurrentThreadId();
+#else
+			auto nativeThread = pthread_self();
+#endif
+			bbThread = bbThreadRegister(nativeThread);
+
             while (running) {
             while (running) {
                 std::this_thread::sleep_for(interval);
                 std::this_thread::sleep_for(interval);
                 timeout();
                 timeout();
             }
             }
+
+			bbThreadUnregister(bbThread);
         });
         });
     }
     }
 
 

+ 6 - 4
steamsdk.mod/steamsdk.bmx

@@ -1,4 +1,4 @@
-' Copyright (c) 2019 Bruce A Henderson
+' Copyright (c) 2019-2020 Bruce A Henderson
 ' 
 ' 
 ' This software is provided 'as-is', without any express or implied
 ' This software is provided 'as-is', without any express or implied
 ' warranty. In no event will the authors be held liable for any damages
 ' warranty. In no event will the authors be held liable for any damages
@@ -21,13 +21,15 @@ SuperStrict
 Rem
 Rem
 bbdoc: Steam SDK
 bbdoc: Steam SDK
 End Rem
 End Rem
-Module steam.steamsdk
+Module Steam.SteamSDK
 
 
-ModuleInfo "Version: 1.02"
+ModuleInfo "Version: 1.03"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Steam SDK - Valve Corporation"
 ModuleInfo "Copyright: Steam SDK - Valve Corporation"
-ModuleInfo "Copyright: Wrapper - 2019 Bruce A Henderson"
+ModuleInfo "Copyright: Wrapper - 2019-2020 Bruce A Henderson"
 
 
+ModuleInfo "History: 1.03"
+ModuleInfo "History: Fixed thread registration."
 ModuleInfo "History: 1.02"
 ModuleInfo "History: 1.02"
 ModuleInfo "History: Added ISteamFriends API."
 ModuleInfo "History: Added ISteamFriends API."
 ModuleInfo "History: 1.01"
 ModuleInfo "History: 1.01"