- In the case the port is created in Kernel context force it to stay in kernel team,

as the creation can be initated by a UL thread



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36025 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2010-04-02 11:31:39 +00:00
parent ecd60ae87e
commit 2e26da485a
1 changed files with 18 additions and 4 deletions

View File

@ -2,12 +2,11 @@
* Copyright 2009 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef PORTLISTENER_H_
#define PORTLISTENER_H_
#ifndef PORTLISTENER_H_
#define PORTLISTENER_H_
#include <OS.h>
template <
typename TYPE,
ssize_t MAX_MESSAGE_SIZE = 256,
@ -71,8 +70,12 @@ public:
if (fPort < B_OK)
return fPort;
// Create Thread
#ifdef KERNEL_LAND
// if this is the case you better stay with kernel
set_port_owner(fPort, 1);
#endif
// Create Thread
fThread = find_thread(fThreadName);
if (fThread < B_OK) {
#ifdef KERNEL_LAND
@ -162,8 +165,19 @@ private:
if (status != B_OK)
break;
}
#ifdef DEBUG_PORTLISTENER
#ifdef KERNEL_LAND
dprintf("Error in PortListener handler=%s port=%s\n", strerror(status),
strerror(ssizePort));
#else
printf("Error in PortListener handler=%s port=%s\n", strerror(status),
strerror(ssizePort));
#endif
#endif
free(buffer);
if (ssizePort == B_BAD_PORT_ID) // the port disappeared