BLooper::InitData() will now choose a default name ("anonymous looper") in case

no name was specified on creation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12878 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-05-29 00:33:34 +00:00
parent 9620c1d716
commit dd3d1f72ac
+19 -14
View File
@@ -1146,8 +1146,10 @@ status_t BLooper::_LockComplete(BLooper* loop, int32 old, thread_id this_tid,
// What is this for? Hope I'm not missing something conceptually here ... // What is this for? Hope I'm not missing something conceptually here ...
return B_ERROR; return B_ERROR;
} }
//------------------------------------------------------------------------------
void BLooper::InitData()
void
BLooper::InitData()
{ {
fOwner = B_ERROR; fOwner = B_ERROR;
fRunCalled = false; fRunCalled = false;
@@ -1159,27 +1161,28 @@ void BLooper::InitData()
fTerminating = false; fTerminating = false;
fMsgPort = -1; fMsgPort = -1;
if (sTeamID == -1) if (sTeamID == -1) {
{
thread_info info; thread_info info;
get_thread_info(find_thread(NULL), &info); get_thread_info(find_thread(NULL), &info);
sTeamID = info.team; sTeamID = info.team;
} }
} }
//------------------------------------------------------------------------------
void BLooper::InitData(const char* name, int32 priority, int32 port_capacity)
void
BLooper::InitData(const char *name, int32 priority, int32 portCapacity)
{ {
InitData(); InitData();
if (name == NULL)
name = "anonymous looper";
fLockSem = create_sem(1, name); fLockSem = create_sem(1, name);
if (port_capacity <= 0) if (portCapacity <= 0)
{ portCapacity = B_LOOPER_PORT_DEFAULT_CAPACITY;
port_capacity = B_LOOPER_PORT_DEFAULT_CAPACITY;
}
fMsgPort = create_port(port_capacity, name ? name : "LooperPort"); fMsgPort = create_port(portCapacity, name);
fInitPriority = priority; fInitPriority = priority;
@@ -1187,8 +1190,10 @@ void BLooper::InitData(const char* name, int32 priority, int32 port_capacity)
AddLooper(this); AddLooper(this);
AddHandler(this); AddHandler(this);
} }
//------------------------------------------------------------------------------
void BLooper::AddMessage(BMessage* msg)
void
BLooper::AddMessage(BMessage* msg)
{ {
// NOTE: Why is this here? // NOTE: Why is this here?
} }