Changeset 27886 in vbox
- Timestamp:
- Mar 31, 2010 12:18:38 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r27882 r27886 931 931 } 932 932 933 int Appliance::TaskExportOVF::startThread()934 {935 int vrc = RTThreadCreate(NULL, Appliance::taskThreadWriteOVF, this,936 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,937 "Appliance::Task");938 939 ComAssertMsgRCRet(vrc,940 ("Could not create taskThreadWriteOVF (%Rrc)\n", vrc), E_FAIL);941 942 return S_OK;943 }944 945 933 //////////////////////////////////////////////////////////////////////////////// 946 934 // -
trunk/src/VBox/Main/ApplianceImplExport.cpp
r27837 r27886 602 602 /** 603 603 * Implementation for writing out the OVF to disk. This starts a new thread which will call 604 * Appliance::taskThreadWriteOVF(). This is in a separate private method because it is used 605 * from two locations: 604 * Appliance::taskThreadWriteOVF(). 605 * 606 * This is in a separate private method because it is used from two locations: 606 607 * 607 608 * 1) from the public Appliance::Write(). … … 650 651 651 652 return rc; 653 } 654 655 /** 656 * 657 * @return 658 */ 659 int Appliance::TaskExportOVF::startThread() 660 { 661 int vrc = RTThreadCreate(NULL, Appliance::taskThreadWriteOVF, this, 662 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0, 663 "Appliance::Task"); 664 665 ComAssertMsgRCRet(vrc, 666 ("Could not create taskThreadWriteOVF (%Rrc)\n", vrc), E_FAIL); 667 668 return S_OK; 652 669 } 653 670 -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r27882 r27886 562 562 563 563 /** 564 * Implementation for reading an OVF. This starts a new thread which will call 565 * Appliance::taskThreadImportOVF() which will then call readFS() or readS3(). 566 * 567 * This is in a separate private method because it is used from two locations: 568 * 569 * 1) from the public Appliance::Read(). 570 * 2) from Appliance::readS3(), which got called from a previous instance of Appliance::taskThreadImportOVF(). 564 571 * 565 572 * @param aLocInfo … … 615 622 /** 616 623 * 624 * @return 625 */ 626 int Appliance::TaskImportOVF::startThread() 627 { 628 int vrc = RTThreadCreate(NULL, Appliance::taskThreadImportOVF, this, 629 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0, 630 "Appliance::Task"); 631 632 ComAssertMsgRCRet(vrc, 633 ("Could not create taskThreadImportOVF (%Rrc)\n", vrc), E_FAIL); 634 635 return S_OK; 636 } 637 638 /** 639 * Thread function for the thread started in Appliance::readImpl() and Appliance::importImpl(). 640 * This will in turn call Appliance::readFS() or Appliance::readS3() or Appliance::importFS() 641 * or Appliance::importS3(). 642 * 643 * @param aThread 644 * @param pvUser 645 */ 646 /* static */ 647 DECLCALLBACK(int) Appliance::taskThreadImportOVF(RTTHREAD /* aThread */, void *pvUser) 648 { 649 std::auto_ptr<TaskImportOVF> task(static_cast<TaskImportOVF*>(pvUser)); 650 AssertReturn(task.get(), VERR_GENERAL_FAILURE); 651 652 Appliance *pAppliance = task->pAppliance; 653 654 LogFlowFuncEnter(); 655 LogFlowFunc(("Appliance %p\n", pAppliance)); 656 657 HRESULT taskrc = S_OK; 658 659 switch (task->taskType) 660 { 661 case TaskImportOVF::Read: 662 { 663 if (task->locInfo.storageType == VFSType_File) 664 taskrc = pAppliance->readFS(task.get()); 665 else if (task->locInfo.storageType == VFSType_S3) 666 taskrc = pAppliance->readS3(task.get()); 667 break; 668 } 669 case TaskImportOVF::Import: 670 { 671 if (task->locInfo.storageType == VFSType_File) 672 taskrc = pAppliance->importFS(task.get()); 673 else if (task->locInfo.storageType == VFSType_S3) 674 taskrc = pAppliance->importS3(task.get()); 675 break; 676 } 677 } 678 679 task->rc = taskrc; 680 681 LogFlowFuncLeave(); 682 683 return VINF_SUCCESS; 684 } 685 686 /** 687 * Actual worker code for reading an OVF from disk. This is called from Appliance::taskThreadImportOVF() 688 * and therefore runs on the OVF read worker thread. This runs in two contexts: 689 * 690 * 1) in a first worker thread; in that case, Appliance::Read() called Appliance::readImpl(); 691 * 692 * 2) in a second worker thread; in that case, Appliance::Read() called Appliance::readImpl(), which 693 * called Appliance::readS3(), which called Appliance::readImpl(), which then called this. 694 * 617 695 * @param pTask 618 696 * @return … … 666 744 667 745 /** 746 * Worker code for writing out OVF to the cloud. This is called from Appliance::taskThreadImportOVF() 747 * in S3 mode and therefore runs on the OVF read worker thread. This then starts a second worker 748 * thread to create temporary files (see Appliance::readFS()). 668 749 * 669 750 * @param pTask … … 863 944 864 945 /** 865 * Implementation of the import code. This gets called from the public Appliance::ImportMachines() 866 * method as well as Appliance::importS3(). 946 * Implementation for importing OVF data into VirtualBox. This starts a new thread which will call 947 * Appliance::taskThreadImportOVF(). 948 * 949 * This is in a separate private method because it is used from two locations: 950 * 951 * 1) from the public Appliance::ImportMachines(). 952 * 2) from Appliance::importS3(), which got called from a previous instance of Appliance::taskThreadImportOVF(). 953 * 867 954 * @param aLocInfo 868 955 * @param aProgress … … 902 989 903 990 /** 904 * Worker thread implementation for Read() (ovf reader). 905 * @param aThread 906 * @param pvUser 907 */ 908 /* static */ 909 DECLCALLBACK(int) Appliance::taskThreadImportOVF(RTTHREAD /* aThread */, void *pvUser) 910 { 911 std::auto_ptr<TaskImportOVF> task(static_cast<TaskImportOVF*>(pvUser)); 912 AssertReturn(task.get(), VERR_GENERAL_FAILURE); 913 914 Appliance *pAppliance = task->pAppliance; 915 916 LogFlowFuncEnter(); 917 LogFlowFunc(("Appliance %p\n", pAppliance)); 918 919 switch (task->taskType) 920 { 921 case TaskImportOVF::Read: 922 { 923 if (task->locInfo.storageType == VFSType_File) 924 pAppliance->readFS(task.get()); 925 else if (task->locInfo.storageType == VFSType_S3) 926 pAppliance->readS3(task.get()); 927 break; 928 } 929 case TaskImportOVF::Import: 930 { 931 if (task->locInfo.storageType == VFSType_File) 932 pAppliance->importFS(task.get()); 933 else if (task->locInfo.storageType == VFSType_S3) 934 pAppliance->importS3(task.get()); 935 break; 936 } 937 } 938 939 LogFlowFuncLeave(); 940 941 return VINF_SUCCESS; 942 } 943 944 /** 991 * Actual worker code for importing OVF data into VirtualBox. This is called from Appliance::taskThreadImportOVF() 992 * and therefore runs on the OVF import worker thread. This runs in two contexts: 945 993 * 946 * @return 947 */ 948 int Appliance::TaskImportOVF::startThread() 949 { 950 int vrc = RTThreadCreate(NULL, Appliance::taskThreadImportOVF, this, 951 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0, 952 "Appliance::Task"); 953 954 ComAssertMsgRCRet(vrc, 955 ("Could not create taskThreadImportOVF (%Rrc)\n", vrc), E_FAIL); 956 957 return S_OK; 958 } 959 960 /** 994 * 1) in a first worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(); 995 * 996 * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which 997 * called Appliance::importS3(), which called Appliance::importImpl(), which then called this. 961 998 * 962 999 * @param pTask … … 1800 1837 1801 1838 /** 1802 * 1839 * Gets called from taskThreadImportOVF(). 1803 1840 * @param pTask 1804 1841 * @return
Note:
See TracChangeset
for help on using the changeset viewer.