// swap out threadstate since the call threads will create
// 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);
pt = nextpt;
}
PyThreadState_Swap(mainThreadState);
+ PyEval_ReleaseThread(mainThreadState);
switch_yield(1000000);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
mainInterpreterState = mainThreadState->interp;
myThreadState = PyThreadState_New(mainInterpreterState);
PyThreadState_Swap(myThreadState);
+ PyEval_ReleaseThread(myThreadState);
Py_Finalize();
+ // Release the global interpreter lock
+ PyEval_SaveThread();
+
return SWITCH_STATUS_UNLOAD;
}