source/bases/Win32Service.c
//-----------------------------------------------------------------------------
// Service_SessionChange()
//   Called when a session has changed.
//-----------------------------------------------------------------------------
Service_SessionChange()
Called when a session has changed.
Service_SessionChange () Called when a session has changed .
static int Service_SessionChange(DWORD sessionId, DWORD eventType)
{
    PyThreadState *threadState;
    PyObject *result;
    threadState = PyThreadState_New(gInterpreterState);
    if (!threadState)
        return LogPythonException("unable to create new thread state");
    PyEval_AcquireThread(threadState);
    result = PyObject_CallMethod(gInstance, "session_changed", "ii",
                                 sessionId, eventType);
    if (!result)
        result = PyObject_CallMethod(gInstance, "sessionChanged", "ii",
                                     sessionId, eventType);
    if (!result)
        return LogPythonException("exception calling session_changed method");
    Py_DECREF(result);
    PyThreadState_Clear(threadState);
    PyEval_ReleaseThread(threadState);
    PyThreadState_Delete(threadState);
    return 0;
}
static int Service_SessionChange ( DWORD sessionId , DWORD eventType ) { PyThreadState * threadState ; PyObject * result ; threadState = PyThreadState_New ( gInterpreterState ) ; if ( ! threadState ) return LogPythonException ( " " ) ; PyEval_AcquireThread ( threadState ) ; result = PyObject_CallMethod ( gInstance , " " , " " , sessionId , eventType ) ; if ( ! result ) result = PyObject_CallMethod ( gInstance , " " , " " , sessionId , eventType ) ; if ( ! result ) return LogPythonException ( " " ) ; Py_DECREF ( result ) ; PyThreadState_Clear ( threadState ) ; PyEval_ReleaseThread ( threadState ) ; PyThreadState_Delete ( threadState ) ; return 0 ; }
Service_SessionChange()
Called when a session has changed.
Service_SessionChange () Called when a session has changed .
// create a new Python thread and acquire the global interpreter lock // call Python method // destroy the Python thread and release the global interpreter lock