From 2e26da485ab6777a6ef7041f7467649788ce5da9 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Fri, 2 Apr 2010 11:31:39 +0000 Subject: [PATCH] - 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 --- headers/private/bluetooth/PortListener.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/headers/private/bluetooth/PortListener.h b/headers/private/bluetooth/PortListener.h index c9d0376b9a..fb7a862adc 100644 --- a/headers/private/bluetooth/PortListener.h +++ b/headers/private/bluetooth/PortListener.h @@ -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 - 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