1
0

Try to get main to quit

This commit is contained in:
Scott E. Graves
2017-03-22 18:51:45 -05:00
parent 156ada3e73
commit eafd598717

View File

@@ -848,8 +848,6 @@ public:
{
_siaApi = siaApi;
_siaDriveConfig = siaDriveConfig;
// May spend a little wait time here while files are cleaned-up and re-added to queue
_uploadManager.reset(new CUploadManager(CSiaCurl(siaApi->GetHostConfig()), siaDriveConfig));
_dokanOps.Cleanup = Sia_Cleanup;
_dokanOps.CloseFile = Sia_CloseFile;
_dokanOps.DeleteDirectory = nullptr;
@@ -891,6 +889,8 @@ public:
_mountPoint = tmp;
_mountThread.reset(new std::thread([&]()
{
// May spend a little wait time here while files are cleaned-up and re-added to queue
_uploadManager.reset(new CUploadManager(CSiaCurl(_siaApi->GetHostConfig()), _siaDriveConfig));
_dokanOptions.MountPoint = _mountPoint.ToUpper().str().c_str();
_mountStatus = DokanMain(&_dokanOptions, &_dokanOps);
OutputDebugString(std::to_wstring(_mountStatus).c_str());
@@ -902,7 +902,8 @@ public:
{
if (_mountThread)
{
DokanRemoveMountPoint(&_mountPoint[0]);
while (!DokanRemoveMountPoint(&_mountPoint[0]))
::Sleep(1000);
_mountThread->join();
_mountThread.reset(nullptr);
_mountPoint = "";