コード例 #1
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++;
  }
}
コード例 #2
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();
}
コード例 #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();
  }
}