c6a2527297
the MessageLooper class - the other part is called from there as virtual _PrepareQuit(). Moved the class documentation to the source file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13815 a95241bf-73f2-0310-859d-f6bbb57e9c96
46 lines
956 B
C++
46 lines
956 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; }
|
|
|
|
private:
|
|
virtual void _PrepareQuit();
|
|
virtual void _GetLooperName(char* name, size_t length);
|
|
virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
|
virtual void _MessageLooper();
|
|
virtual port_id _MessagePort() const = 0;
|
|
|
|
static int32 _message_thread(void *_looper);
|
|
|
|
protected:
|
|
thread_id fThread;
|
|
BPrivate::PortLink fLink;
|
|
bool fQuitting;
|
|
};
|
|
|
|
static const uint32 kMsgQuitLooper = 'quit';
|
|
|
|
#endif /* MESSAGE_LOOPER_H */
|