- Port & Thread string's name allocation was messed and used in InitCheck.
- Style, spacing binary operator git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34881 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -22,10 +22,13 @@ public:
|
|||||||
fInformation.func = handler;
|
fInformation.func = handler;
|
||||||
fInformation.port = &fPort;
|
fInformation.port = &fPort;
|
||||||
|
|
||||||
InitCheck();
|
|
||||||
fPortName = strdup(name);
|
fPortName = strdup(name);
|
||||||
fThreadName = strdup(name);
|
|
||||||
|
fThreadName = (char*)malloc(strlen(name) + strlen(" thread") + 1);
|
||||||
|
fThreadName = strcpy(fThreadName, fPortName);
|
||||||
fThreadName = strcat(fThreadName, " thread");
|
fThreadName = strcat(fThreadName, " thread");
|
||||||
|
|
||||||
|
InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,8 +40,8 @@ public:
|
|||||||
// Closing the port should provoke the thread to finish
|
// Closing the port should provoke the thread to finish
|
||||||
wait_for_thread(fThread, &status);
|
wait_for_thread(fThread, &status);
|
||||||
|
|
||||||
delete fThreadName;
|
free(fThreadName);
|
||||||
delete fPortName;
|
free(fPortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return write_port(fPort, code, buffer, sizeof(TYPE));
|
return write_port(fPort, code, buffer, sizeof(TYPE));
|
||||||
else
|
else
|
||||||
@@ -68,7 +71,7 @@ public:
|
|||||||
fPort = create_port(MAX_MESSAGE_DEEP, fPortName);
|
fPort = create_port(MAX_MESSAGE_DEEP, fPortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fPort < B_OK)
|
if (fPort < B_OK)
|
||||||
return fPort;
|
return fPort;
|
||||||
|
|
||||||
// Create Thread
|
// Create Thread
|
||||||
@@ -96,7 +99,7 @@ public:
|
|||||||
status_t Launch()
|
status_t Launch()
|
||||||
{
|
{
|
||||||
status_t check = InitCheck();
|
status_t check = InitCheck();
|
||||||
|
|
||||||
if (check < B_OK)
|
if (check < B_OK)
|
||||||
return check;
|
return check;
|
||||||
|
|
||||||
@@ -144,12 +147,12 @@ private:
|
|||||||
while ((ssizePort = port_buffer_size(*port)) != B_BAD_PORT_ID) {
|
while ((ssizePort = port_buffer_size(*port)) != B_BAD_PORT_ID) {
|
||||||
|
|
||||||
if (ssizePort <= 0) {
|
if (ssizePort <= 0) {
|
||||||
snooze(500*1000);
|
snooze(500 * 1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssizePort > MAX_MESSAGE_SIZE) {
|
if (ssizePort > MAX_MESSAGE_SIZE) {
|
||||||
snooze(500*1000);
|
snooze(500 * 1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +171,7 @@ private:
|
|||||||
|
|
||||||
if (ssizePort == B_BAD_PORT_ID) // the port disappeared
|
if (ssizePort == B_BAD_PORT_ID) // the port disappeared
|
||||||
return ssizePort;
|
return ssizePort;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user