* Added "bool wait" parameter to ModelLoader::Abort(), allowing to optionally

wait for the loader thread.
* MainWindow::Quit() aborts the loader now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30425 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-04-26 11:02:50 +00:00
parent 1ca32f2c10
commit 926160e8ac
3 changed files with 16 additions and 8 deletions
@@ -84,10 +84,7 @@ ModelLoader::ModelLoader(DataSource* dataSource,
ModelLoader::~ModelLoader()
{
if (fLoaderThread >= 0) {
Abort();
wait_for_thread(fLoaderThread, NULL);
}
Abort(true);
delete fDataSource;
delete fModel;
@@ -128,14 +125,22 @@ ModelLoader::StartLoading()
void
ModelLoader::Abort()
ModelLoader::Abort(bool wait)
{
AutoLocker<BLocker> locker(fLock);
if (!fLoading || fAborted)
if (fLoaderThread < 0)
return;
fAborted = true;
thread_id thread = fLoaderThread;
if (fLoading)
fAborted = true;
locker.Unlock();
if (wait)
wait_for_thread(thread, NULL);
}