예제 #1
0
void _Py_MakePendingCalls()
{
    g_critSectionPyCall.enterMutex();

    CallQueue::iterator iter = g_callQueue.begin();
    while (iter != g_callQueue.end())
    {
        int(*f)(void*) = (*iter).first;
        void* arg = (*iter).second;
        g_callQueue.erase(iter);
        g_critSectionPyCall.leaveMutex();
        if (f)
            f(arg);
        //(*((*iter).first))((*iter).second);
        g_critSectionPyCall.enterMutex();
        iter = g_callQueue.begin();
    }
    g_critSectionPyCall.leaveMutex();
}
예제 #2
0
파일: pyutil.cpp 프로젝트: AWilco/xbmc
void _PyXBMC_ClearPendingCalls(PyThreadState* state)
{
  CSingleLock lock(g_critSectionPyCall);
  for(CallQueue::iterator it = g_callQueue.begin(); it!= g_callQueue.end();)
  {
    if(it->state == state)
      it = g_callQueue.erase(it);
    else
      it++;
  }
}
예제 #3
0
void _PyXBMC_MakePendingCalls()
{
  CSingleLock lock(g_critSectionPyCall);
  CallQueue::iterator iter = g_callQueue.begin();
  while (iter != g_callQueue.end())
  {
    SPending p(*iter);
    // only call when we are in the right thread state
    if(p.state != PyThreadState_Get())
    {
      iter++;
      continue;
    }
    g_callQueue.erase(iter);
    lock.Leave();
    if (p.func)
      p.func(p.args);
    //(*((*iter).first))((*iter).second);
    lock.Enter();
    iter = g_callQueue.begin();
  }
}
예제 #4
0
파일: pyutil.cpp 프로젝트: AWilco/xbmc
void _PyXBMC_MakePendingCalls()
{
  CSingleLock lock(g_critSectionPyCall);
  CallQueue::iterator iter = g_callQueue.begin();
  while (iter != g_callQueue.end())
  {
    SPending p(*iter);
    // only call when we are in the right thread state
    if(p.state != PyThreadState_Get())
    {
      iter++;
      continue;
    }
    g_callQueue.erase(iter);
    lock.Leave();
    if (p.func)
    {
      p.func(p.args);

      // Since the callback is likely to make it into python, and since
      // not all of the callback functions handle errors, the error state
      // may remain set from the previous call. As a result subsequent calls
      // to callback functions exhibit odd behavior difficult to debug.
      if (PyErr_Occurred())
      {
        CLog::Log(LOGERROR,"Exception in python script callback execution");

        // This clears the python error state and prints it to the log
        PyErr_Print();
      }

    }
    //(*((*iter).first))((*iter).second);
    lock.Enter();
    iter = g_callQueue.begin();
  }
}