Got rid of the looper ID stuff - it seems nowhere to be used.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19965 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-01-26 12:11:33 +00:00
parent 88df8322a9
commit aa33d0a928
2 changed files with 28 additions and 77 deletions

View File

@ -1,54 +1,26 @@
//------------------------------------------------------------------------------
// 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: LooperList.h
// Author(s): Erik Jaesler (erik@cgsoftware.com)
// Description: Maintains a global list of all loopers in a given team.
//------------------------------------------------------------------------------
/*
* Copyright 2001-2007, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/
#ifndef LOOPERLIST_H
#define LOOPERLIST_H
// Standard Includes -----------------------------------------------------------
#include <vector>
// System Includes -------------------------------------------------------------
#include <Locker.h>
#include <OS.h>
#include <SupportDefs.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
#include <vector>
class BLooper;
namespace BPrivate {
class BLooperList
{
class BLooperList {
public:
BLooperList();
@ -66,39 +38,33 @@ class BLooperList
BLooper* LooperForName(const char* name);
BLooper* LooperForPort(port_id port);
struct LooperData
{
private:
struct LooperData {
LooperData();
LooperData(BLooper* loop, uint32 i);
LooperData(BLooper* looper);
LooperData(const LooperData& rhs);
LooperData& operator=(const LooperData& rhs);
BLooper* looper;
uint32 id;
};
private:
static bool EmptySlotPred(LooperData& Data);
struct FindLooperPred
{
static bool EmptySlotPred(LooperData& Data);
struct FindLooperPred {
FindLooperPred(const BLooper* loop) : looper(loop) {;}
bool operator()(LooperData& Data);
const BLooper* looper;
};
struct FindThreadPred
{
struct FindThreadPred {
FindThreadPred(thread_id tid) : thread(tid) {;}
bool operator()(LooperData& Data);
thread_id thread;
};
struct FindNamePred
{
struct FindNamePred {
FindNamePred(const char* n) : name(n) {;}
bool operator()(LooperData& Data);
const char* name;
};
struct FindPortPred
{
struct FindPortPred {
FindPortPred(port_id pid) : port(pid) {;}
bool operator()(LooperData& Data);
port_id port;
@ -107,20 +73,11 @@ class BLooperList
void AssertLocked();
BLocker fLock;
uint32 fLooperID;
std::vector<LooperData> fData;
};
extern _IMPEXP_BE BLooperList gLooperList;
}
extern BLooperList gLooperList;
} // namespace BPrivate
#endif //LOOPERLIST_H
/*
* $Log $
*
* $Id $
*
*/
#endif // LOOPERLIST_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2007, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -28,8 +28,7 @@ typedef vector<BLooperList::LooperData>::iterator LooperDataIterator;
BLooperList::BLooperList()
:
fLock("BLooperList lock"),
fLooperID(0)
fLock("BLooperList lock")
{
}
@ -63,13 +62,10 @@ BLooperList::AddLooper(BLooper* looper)
if (!IsLooperValid(looper)) {
LooperDataIterator i = find_if(fData.begin(), fData.end(), EmptySlotPred);
if (i == fData.end()) {
fData.push_back(LooperData(looper, ++fLooperID));
looper->fLooperID = fLooperID;
fData.push_back(LooperData(looper));
looper->Lock();
} else {
i->looper = looper;
i->id = ++fLooperID;
looper->fLooperID = fLooperID;
looper->Lock();
}
}
@ -201,13 +197,13 @@ BLooperList::AssertLocked()
BLooperList::LooperData::LooperData()
: looper(NULL), id(0)
: looper(NULL)
{
}
BLooperList::LooperData::LooperData(BLooper* loop, uint32 i)
: looper(loop), id(i)
BLooperList::LooperData::LooperData(BLooper* looper)
: looper(looper)
{
}
@ -221,10 +217,8 @@ BLooperList::LooperData::LooperData(const LooperData& other)
BLooperList::LooperData&
BLooperList::LooperData::operator=(const LooperData& other)
{
if (this != &other) {
if (this != &other)
looper = other.looper;
id = other.id;
}
return *this;
}