d9acbaf0dc
If we fail to lock the window in the kInitialTickRate time, quit the thread. We were deadlocking causing #4260 because you could open several threads by moving through the screen saver list quickly all trying to lock the same window at the same time, classic deadlock.
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
/*
|
|
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
* Jérôme Duval, jerome.duval@free.fr
|
|
* Michael Phipps
|
|
* John Scipione, jscipione@gmail.com
|
|
*/
|
|
#ifndef SCREEN_SAVER_RUNNER_H
|
|
#define SCREEN_SAVER_RUNNER_H
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
#include <DirectWindow.h>
|
|
|
|
|
|
class BScreenSaver;
|
|
class BView;
|
|
class ScreenSaverSettings;
|
|
|
|
|
|
class ScreenSaverRunner {
|
|
public:
|
|
ScreenSaverRunner(BWindow* window, BView* view,
|
|
bool preview,
|
|
ScreenSaverSettings& settings);
|
|
~ScreenSaverRunner();
|
|
|
|
BScreenSaver* ScreenSaver() const;
|
|
bool HasStarted() const;
|
|
|
|
status_t Run();
|
|
void Quit();
|
|
|
|
void Suspend();
|
|
void Resume();
|
|
|
|
private:
|
|
void _LoadAddOn();
|
|
void _CleanUp();
|
|
static status_t _ThreadFunc(void* data);
|
|
status_t _Run();
|
|
|
|
BScreenSaver* fSaver;
|
|
BWindow* fWindow;
|
|
BDirectWindow* fDirectWindow;
|
|
BView* fView;
|
|
ScreenSaverSettings& fSettings;
|
|
bool fPreview;
|
|
bool fHasStarted;
|
|
|
|
image_id fAddonImage;
|
|
thread_id fThread;
|
|
volatile bool fQuitting;
|
|
};
|
|
|
|
#endif // SCREEN_SAVER_RUNNER_H
|