Some cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17840 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-06-14 18:31:15 +00:00
parent 7477c792d5
commit a6c9722d73
2 changed files with 139 additions and 226 deletions
+8 -48
View File
@@ -1,46 +1,17 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Handler.cpp
// Author: Erik Jaesler ([email protected])
// Description: BHandler defines the message-handling protocol.
// MessageReceived() is its lynchpin.
//------------------------------------------------------------------------------
/*
* Copyright 2001-2006, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler ([email protected])
*/
#ifndef _HANDLER_H
#define _HANDLER_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Archivable.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BLooper;
class BMessageFilter;
@@ -52,9 +23,8 @@ class _ObserverList;
#define B_OBSERVE_ORIGINAL_WHAT "be:observe_orig_what"
const uint32 B_OBSERVER_OBSERVE_ALL = 0xffffffff;
// BHandler class --------------------------------------------------------------
class BHandler : public BArchivable {
class BHandler : public BArchivable {
public:
BHandler(const char* name = NULL);
virtual ~BHandler();
@@ -110,7 +80,6 @@ public:
virtual void SendNotices(uint32 what, const BMessage* = 0);
bool IsWatched() const;
//----- Private or reserved -----------------------------------------
private:
typedef BArchivable _inherited;
friend inline int32 _get_object_token_(const BHandler* );
@@ -135,14 +104,5 @@ private:
_ObserverList* fObserverList;
uint32 _reserved[3];
};
//------------------------------------------------------------------------------
#endif // _HANDLER_H
/*
* $Log $
*
* $Id $
*
*/
+18 -65
View File
@@ -1,61 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Looper.h
// Author(s): Erik Jaesler ([email protected])
// DarkWyrm ([email protected])
// Description: BLooper class spawns a thread that runs a message loop.
//------------------------------------------------------------------------------
/*
* Copyright 2001-2006, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler ([email protected])
*/
#ifndef _LOOPER_H
#define _LOOPER_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Handler.h>
#include <List.h>
#include <OS.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BMessage;
class BMessageQueue;
namespace BPrivate {
class BLooperList;
}
struct _loop_data_;
// Port (Message Queue) Capacity -----------------------------------------------
// Port (Message Queue) Capacity
#define B_LOOPER_PORT_DEFAULT_CAPACITY 100
// BLooper class ---------------------------------------------------------------
class BLooper : public BHandler {
public:
BLooper(const char* name = NULL,
@@ -71,11 +40,9 @@ virtual status_t Archive(BMessage* data, bool deep = true) const;
// Message transmission
status_t PostMessage(uint32 command);
status_t PostMessage(BMessage* message);
status_t PostMessage(uint32 command,
BHandler* handler,
status_t PostMessage(uint32 command, BHandler* handler,
BHandler* reply_to = NULL);
status_t PostMessage(BMessage* message,
BHandler* handler,
status_t PostMessage(BMessage* message, BHandler* handler,
BHandler* reply_to = NULL);
virtual void DispatchMessage(BMessage* message, BHandler* handler);
@@ -114,10 +81,8 @@ static BLooper* LooperForThread(thread_id tid);
sem_id Sem() const;
// Scripting
virtual BHandler* ResolveSpecifier(BMessage* msg,
int32 index,
BMessage* specifier,
int32 form,
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
@@ -156,19 +121,16 @@ virtual void _ReservedLooper6();
BLooper(const BLooper&);
BLooper& operator=(const BLooper&);
BLooper(int32 priority, port_id port, const char* name);
BLooper(int32 priority, port_id port,
const char* name);
status_t _PostMessage(BMessage* msg,
BHandler* handler,
status_t _PostMessage(BMessage* msg, BHandler* handler,
BHandler* reply_to);
static status_t _Lock(BLooper* loop,
port_id port,
static status_t _Lock(BLooper* loop, port_id port,
bigtime_t timeout);
static status_t _LockComplete(BLooper* loop,
int32 old,
thread_id this_tid,
sem_id sem,
static status_t _LockComplete(BLooper* loop, int32 old,
thread_id this_tid, sem_id sem,
bigtime_t timeout);
void InitData();
void InitData(const char* name, int32 prio, int32 capacity);
@@ -224,14 +186,5 @@ static BLooper* LooperForPort(port_id port);
size_t fMsgBufferSize;
uint32 _reserved[6];
};
//------------------------------------------------------------------------------
#endif // _LOOPER_H
/*
* $Log $
*
* $Id $
*
*/