haiku/src/servers/app/MessageLooper.h
Axel Dörfler 35a71b1936 The app_server now inherits from MessageLooper as well.
Removed unused stuff.
The app_server now deletes itself when done (and therefore must not be
allocated on the stack anymore).
The cursor handling should be moved over to the desktop as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-25 21:53:48 +00:00

49 lines
1017 B
C++

/*
* Copyright 2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef MESSAGE_LOOPER_H
#define MESSAGE_LOOPER_H
#include <PortLink.h>
#include <Locker.h>
#include <OS.h>
class MessageLooper : public BLocker {
public:
MessageLooper(const char* name);
virtual ~MessageLooper();
virtual bool Run();
virtual void Quit();
void PostMessage(int32 code);
thread_id Thread() const { return fThread; }
bool IsQuitting() const { return fQuitting; }
virtual port_id MessagePort() const = 0;
private:
virtual void _PrepareQuit();
virtual void _GetLooperName(char* name, size_t length);
virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
virtual void _MessageLooper();
protected:
static int32 _message_thread(void *_looper);
protected:
thread_id fThread;
BPrivate::PortLink fLink;
bool fQuitting;
};
static const int32 kMsgQuitLooper = 'quit';
#endif /* MESSAGE_LOOPER_H */