Author: oruizdorantes Date: 2010-04-02 13:31:39 +0200 (Fri, 02 Apr 2010) New Revision: 36025 Changeset: http://dev.haiku-os.org/changeset/36025/haiku Modified: haiku/trunk/headers/private/bluetooth/PortListener.h Log: - 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 Modified: haiku/trunk/headers/private/bluetooth/PortListener.h =================================================================== --- haiku/trunk/headers/private/bluetooth/PortListener.h 2010-04-02 11:15:10 UTC (rev 36024) +++ haiku/trunk/headers/private/bluetooth/PortListener.h 2010-04-02 11:31:39 UTC (rev 36025) @@ -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 @@ if (fPort < B_OK) return fPort; + #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 @@ 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