void GCThread::execute()
{ // otherwise we crash here, when main has been left already if( isAfterUnloadOrPy_Finalize() ) return; try
{
PyThreadAttach g( mPyInterpreter );
{
Runtime runtime;
// remove the reference from the pythonobject2adapter map
PyRef2Adapter::iterator ii =
runtime.getImpl()->cargo->mappedObjects.find( mPyObject ); if( ii != runtime.getImpl()->cargo->mappedObjects.end() )
{
runtime.getImpl()->cargo->mappedObjects.erase( ii );
}
Py_XDECREF( mPyObject );
}
} catch( const css::uno::RuntimeException & e )
{
OString msg = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US );
fprintf( stderr, "Leaking python objects bridged to UNO for reason %s\n",msg.getStr());
}
}
void decreaseRefCount( PyInterpreterState *interpreter, PyObject *object )
{ // otherwise we crash in the last after main ... if( isAfterUnloadOrPy_Finalize() ) return;
// delegate to a new thread, because there does not seem // to be a method, which tells, whether the global // interpreter lock is held or not // TODO: Look for a more efficient solution try
{
rtl::Reference< GCThread >(new GCThread(interpreter, object))->launch(); //TODO: a protocol is missing how to join with the launched thread // before exit(3), to ensure the thread is no longer relying on any // infrastructure while that infrastructure is being shut down in // atexit handlers
} catch (std::runtime_error&)
{ // tdf#146621: Thread creation will fail on Windows with ERROR_ACCESS_DENIED // when called at ExitProcess time; unhandled exception would hang the process
abort();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.