Changeset 22357 in vbox for trunk/src/libs/xpcom18a4/python
- Timestamp:
- Aug 19, 2009 9:32:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
r21300 r22357 493 493 494 494 #ifdef VBOX 495 495 496 static nsIEventQueue* g_mainEventQ = nsnull; 496 497 … … 575 576 PyXPCOMMethod_DeinitCOM(PyObject *self, PyObject *args) 576 577 { 577 Py_BEGIN_ALLOW_THREADS; 578 deinitVBoxPython(); 579 Py_END_ALLOW_THREADS; 580 return PyInt_FromLong(0); 578 Py_BEGIN_ALLOW_THREADS; 579 deinitVBoxPython(); 580 Py_END_ALLOW_THREADS; 581 return PyInt_FromLong(0); 582 } 583 584 static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); 585 586 static PyObject* 587 PyXPCOMMethod_AttachThread(PyObject *self, PyObject *args) 588 { 589 nsresult rv; 590 PRInt32 result = 0; 591 nsCOMPtr<nsIEventQueueService> eqs; 592 593 // Create the Event Queue for this thread... 594 Py_BEGIN_ALLOW_THREADS; 595 eqs = 596 do_GetService(kEventQueueServiceCID, &rv); 597 Py_END_ALLOW_THREADS; 598 if (NS_FAILED(rv)) 599 { 600 result = 1; 601 goto done; 602 } 603 604 Py_BEGIN_ALLOW_THREADS; 605 rv = eqs->CreateThreadEventQueue(); 606 Py_END_ALLOW_THREADS; 607 if (NS_FAILED(rv)) 608 { 609 result = 2; 610 goto done; 611 } 612 613 done: 614 /** @todo: better throw an exception on error */ 615 return PyInt_FromLong(result); 616 } 617 618 static PyObject* 619 PyXPCOMMethod_DetachThread(PyObject *self, PyObject *args) 620 { 621 nsresult rv; 622 PRInt32 result = 0; 623 nsCOMPtr<nsIEventQueueService> eqs; 624 625 // Destroy the Event Queue for this thread... 626 Py_BEGIN_ALLOW_THREADS; 627 eqs = 628 do_GetService(kEventQueueServiceCID, &rv); 629 Py_END_ALLOW_THREADS; 630 if (NS_FAILED(rv)) 631 { 632 result = 1; 633 goto done; 634 } 635 636 Py_BEGIN_ALLOW_THREADS; 637 rv = eqs->DestroyThreadEventQueue(); 638 Py_END_ALLOW_THREADS; 639 if (NS_FAILED(rv)) 640 { 641 result = 2; 642 goto done; 643 } 644 645 done: 646 /** @todo: better throw an exception on error */ 647 return PyInt_FromLong(result); 581 648 } 582 649 #endif … … 609 676 #ifdef VBOX 610 677 {"WaitForEvents", PyXPCOMMethod_WaitForEvents, 1}, 611 {"DeinitCOM", PyXPCOMMethod_DeinitCOM, 1}, 678 {"DeinitCOM", PyXPCOMMethod_DeinitCOM, 1}, 679 {"AttachThread", PyXPCOMMethod_AttachThread, 1}, 680 {"DetachThread", PyXPCOMMethod_DetachThread, 1}, 612 681 #endif 613 682 // These should no longer be used - just use the logging.getLogger('pyxpcom')...
Note:
See TracChangeset
for help on using the changeset viewer.