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:
@@ -1,54 +1,26 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2007, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// 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 ([email protected])
|
|
||||||
// Description: Maintains a global list of all loopers in a given team.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef LOOPERLIST_H
|
#ifndef LOOPERLIST_H
|
||||||
#define LOOPERLIST_H
|
#define LOOPERLIST_H
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
#include <vector>
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BLooper;
|
class BLooper;
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
class BLooperList
|
class BLooperList {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
BLooperList();
|
BLooperList();
|
||||||
|
|
||||||
@@ -66,39 +38,33 @@ class BLooperList
|
|||||||
BLooper* LooperForName(const char* name);
|
BLooper* LooperForName(const char* name);
|
||||||
BLooper* LooperForPort(port_id port);
|
BLooper* LooperForPort(port_id port);
|
||||||
|
|
||||||
struct LooperData
|
private:
|
||||||
{
|
struct LooperData {
|
||||||
LooperData();
|
LooperData();
|
||||||
LooperData(BLooper* loop, uint32 i);
|
LooperData(BLooper* looper);
|
||||||
LooperData(const LooperData& rhs);
|
LooperData(const LooperData& rhs);
|
||||||
LooperData& operator=(const LooperData& rhs);
|
LooperData& operator=(const LooperData& rhs);
|
||||||
|
|
||||||
BLooper* looper;
|
BLooper* looper;
|
||||||
uint32 id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
static bool EmptySlotPred(LooperData& Data);
|
||||||
static bool EmptySlotPred(LooperData& Data);
|
struct FindLooperPred {
|
||||||
struct FindLooperPred
|
|
||||||
{
|
|
||||||
FindLooperPred(const BLooper* loop) : looper(loop) {;}
|
FindLooperPred(const BLooper* loop) : looper(loop) {;}
|
||||||
bool operator()(LooperData& Data);
|
bool operator()(LooperData& Data);
|
||||||
const BLooper* looper;
|
const BLooper* looper;
|
||||||
};
|
};
|
||||||
struct FindThreadPred
|
struct FindThreadPred {
|
||||||
{
|
|
||||||
FindThreadPred(thread_id tid) : thread(tid) {;}
|
FindThreadPred(thread_id tid) : thread(tid) {;}
|
||||||
bool operator()(LooperData& Data);
|
bool operator()(LooperData& Data);
|
||||||
thread_id thread;
|
thread_id thread;
|
||||||
};
|
};
|
||||||
struct FindNamePred
|
struct FindNamePred {
|
||||||
{
|
|
||||||
FindNamePred(const char* n) : name(n) {;}
|
FindNamePred(const char* n) : name(n) {;}
|
||||||
bool operator()(LooperData& Data);
|
bool operator()(LooperData& Data);
|
||||||
const char* name;
|
const char* name;
|
||||||
};
|
};
|
||||||
struct FindPortPred
|
struct FindPortPred {
|
||||||
{
|
|
||||||
FindPortPred(port_id pid) : port(pid) {;}
|
FindPortPred(port_id pid) : port(pid) {;}
|
||||||
bool operator()(LooperData& Data);
|
bool operator()(LooperData& Data);
|
||||||
port_id port;
|
port_id port;
|
||||||
@@ -107,20 +73,11 @@ class BLooperList
|
|||||||
void AssertLocked();
|
void AssertLocked();
|
||||||
|
|
||||||
BLocker fLock;
|
BLocker fLock;
|
||||||
uint32 fLooperID;
|
|
||||||
std::vector<LooperData> fData;
|
std::vector<LooperData> fData;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern _IMPEXP_BE BLooperList gLooperList;
|
extern BLooperList gLooperList;
|
||||||
}
|
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
#endif //LOOPERLIST_H
|
#endif // LOOPERLIST_H
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2007, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -28,8 +28,7 @@ typedef vector<BLooperList::LooperData>::iterator LooperDataIterator;
|
|||||||
|
|
||||||
BLooperList::BLooperList()
|
BLooperList::BLooperList()
|
||||||
:
|
:
|
||||||
fLock("BLooperList lock"),
|
fLock("BLooperList lock")
|
||||||
fLooperID(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,13 +62,10 @@ BLooperList::AddLooper(BLooper* looper)
|
|||||||
if (!IsLooperValid(looper)) {
|
if (!IsLooperValid(looper)) {
|
||||||
LooperDataIterator i = find_if(fData.begin(), fData.end(), EmptySlotPred);
|
LooperDataIterator i = find_if(fData.begin(), fData.end(), EmptySlotPred);
|
||||||
if (i == fData.end()) {
|
if (i == fData.end()) {
|
||||||
fData.push_back(LooperData(looper, ++fLooperID));
|
fData.push_back(LooperData(looper));
|
||||||
looper->fLooperID = fLooperID;
|
|
||||||
looper->Lock();
|
looper->Lock();
|
||||||
} else {
|
} else {
|
||||||
i->looper = looper;
|
i->looper = looper;
|
||||||
i->id = ++fLooperID;
|
|
||||||
looper->fLooperID = fLooperID;
|
|
||||||
looper->Lock();
|
looper->Lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,13 +197,13 @@ BLooperList::AssertLocked()
|
|||||||
|
|
||||||
|
|
||||||
BLooperList::LooperData::LooperData()
|
BLooperList::LooperData::LooperData()
|
||||||
: looper(NULL), id(0)
|
: looper(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BLooperList::LooperData::LooperData(BLooper* loop, uint32 i)
|
BLooperList::LooperData::LooperData(BLooper* looper)
|
||||||
: looper(loop), id(i)
|
: looper(looper)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,10 +217,8 @@ BLooperList::LooperData::LooperData(const LooperData& other)
|
|||||||
BLooperList::LooperData&
|
BLooperList::LooperData&
|
||||||
BLooperList::LooperData::operator=(const LooperData& other)
|
BLooperList::LooperData::operator=(const LooperData& other)
|
||||||
{
|
{
|
||||||
if (this != &other) {
|
if (this != &other)
|
||||||
looper = other.looper;
|
looper = other.looper;
|
||||||
id = other.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user