File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 6
6
#include " pysamp/pysamp.h"
7
7
#include " bindings/callbacks.h"
8
8
#include " test/callbackstest.h"
9
+ #include < thread>
9
10
11
+ std::thread threading;
12
+ bool threadingInitialized = false ;
10
13
11
14
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports ()
12
15
{
@@ -21,7 +24,13 @@ PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
21
24
return false ;
22
25
}
23
26
24
- return sampgdk::Load (ppData);
27
+ bool sgdk = sampgdk::Load (ppData);
28
+ if (sgdk) {
29
+ PySAMP::callback (" OnThreadingInit" , NULL );
30
+ threading = std::thread ([] { PySAMP::callback (" OnThreadingInit" , NULL ); });
31
+
32
+ }
33
+ return false ;
25
34
}
26
35
27
36
PLUGIN_EXPORT void PLUGIN_CALL Unload ()
@@ -31,6 +40,8 @@ PLUGIN_EXPORT void PLUGIN_CALL Unload()
31
40
32
41
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick ()
33
42
{
43
+ PySAMP::callback (" OnThreadingStopSignal" , NULL );
44
+ threading.join ();
34
45
sampgdk::ProcessTick ();
35
46
PySAMP::callback (" OnProcessTick" , NULL );
36
47
}
You can’t perform that action at this time.
0 commit comments