HaikuDepot: Move worker thread init into method
... and call it from the second version of the MainWindow constructor.
This commit is contained in:
parent
027e51ae7d
commit
639756547d
@ -165,21 +165,7 @@ MainWindow::MainWindow(BRect frame, const BMessage& settings)
|
||||
|
||||
_StartRefreshWorker();
|
||||
|
||||
fPendingActionsSem = create_sem(0, "PendingPackageActions");
|
||||
if (fPendingActionsSem >= 0) {
|
||||
fPendingActionsWorker = spawn_thread(&_PackageActionWorker,
|
||||
"Planet Express", B_NORMAL_PRIORITY, this);
|
||||
if (fPendingActionsWorker >= 0)
|
||||
resume_thread(fPendingActionsWorker);
|
||||
}
|
||||
|
||||
fPackageToPopulateSem = create_sem(0, "PopulatePackage");
|
||||
if (fPackageToPopulateSem >= 0) {
|
||||
fPopulatePackageWorker = spawn_thread(&_PopulatePackageWorker,
|
||||
"Package Populator", B_NORMAL_PRIORITY, this);
|
||||
if (fPopulatePackageWorker >= 0)
|
||||
resume_thread(fPopulatePackageWorker);
|
||||
}
|
||||
_InitWorkerThreads();
|
||||
}
|
||||
|
||||
|
||||
@ -214,6 +200,8 @@ MainWindow::MainWindow(BRect frame, const BMessage& settings,
|
||||
}
|
||||
|
||||
fPackageInfoView->SetPackage(package);
|
||||
|
||||
_InitWorkerThreads();
|
||||
}
|
||||
|
||||
|
||||
@ -497,6 +485,27 @@ MainWindow::_BuildMenu(BMenuBar* menuBar)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MainWindow::_InitWorkerThreads()
|
||||
{
|
||||
fPendingActionsSem = create_sem(0, "PendingPackageActions");
|
||||
if (fPendingActionsSem >= 0) {
|
||||
fPendingActionsWorker = spawn_thread(&_PackageActionWorker,
|
||||
"Planet Express", B_NORMAL_PRIORITY, this);
|
||||
if (fPendingActionsWorker >= 0)
|
||||
resume_thread(fPendingActionsWorker);
|
||||
}
|
||||
|
||||
fPackageToPopulateSem = create_sem(0, "PopulatePackage");
|
||||
if (fPackageToPopulateSem >= 0) {
|
||||
fPopulatePackageWorker = spawn_thread(&_PopulatePackageWorker,
|
||||
"Package Populator", B_NORMAL_PRIORITY, this);
|
||||
if (fPopulatePackageWorker >= 0)
|
||||
resume_thread(fPopulatePackageWorker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MainWindow::_AdoptModel()
|
||||
{
|
||||
@ -899,7 +908,7 @@ MainWindow::_PopulatePackageWorker(void* arg)
|
||||
void
|
||||
MainWindow::_NotifyUser(const char* title, const char* message)
|
||||
{
|
||||
BAlert *alert = new(std::nothrow) BAlert(title, message,
|
||||
BAlert* alert = new(std::nothrow) BAlert(title, message,
|
||||
B_TRANSLATE("Close"));
|
||||
|
||||
if (alert != NULL)
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
|
||||
private:
|
||||
void _BuildMenu(BMenuBar* menuBar);
|
||||
void _InitWorkerThreads();
|
||||
void _AdoptModel();
|
||||
|
||||
void _AdoptPackage(const PackageInfoRef& package);
|
||||
|
Loading…
Reference in New Issue
Block a user