[mod_python3] Replace previously removed deprecated calls
This commit is contained in:
parent
f26522f102
commit
578024ed86
|
@ -574,7 +574,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python3_load)
|
||||||
|
|
||||||
// swap out threadstate since the call threads will create
|
// swap out threadstate since the call threads will create
|
||||||
// their own and swap in their threadstate
|
// their own and swap in their threadstate
|
||||||
PyThreadState_Swap(NULL);
|
// and release the global interpreter lock
|
||||||
|
PyEval_SaveThread();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool);
|
switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool);
|
||||||
|
@ -619,6 +621,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown)
|
||||||
pt = nextpt;
|
pt = nextpt;
|
||||||
}
|
}
|
||||||
PyThreadState_Swap(mainThreadState);
|
PyThreadState_Swap(mainThreadState);
|
||||||
|
PyEval_ReleaseThread(mainThreadState);
|
||||||
switch_yield(1000000);
|
switch_yield(1000000);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
|
||||||
|
@ -644,9 +647,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown)
|
||||||
mainInterpreterState = mainThreadState->interp;
|
mainInterpreterState = mainThreadState->interp;
|
||||||
myThreadState = PyThreadState_New(mainInterpreterState);
|
myThreadState = PyThreadState_New(mainInterpreterState);
|
||||||
PyThreadState_Swap(myThreadState);
|
PyThreadState_Swap(myThreadState);
|
||||||
|
PyEval_ReleaseThread(myThreadState);
|
||||||
|
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
|
|
||||||
|
// Release the global interpreter lock
|
||||||
|
PyEval_SaveThread();
|
||||||
|
|
||||||
return SWITCH_STATUS_UNLOAD;
|
return SWITCH_STATUS_UNLOAD;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue