[haiku-commits] r33961 - in haiku/trunk/src: servers/input servers/registrar system/kernel/device_manager

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 9 Nov 2009 16:25:49 +0100 (CET)

Author: axeld
Date: 2009-11-09 16:25:48 +0100 (Mon, 09 Nov 2009)
New Revision: 33961
Changeset: http://dev.haiku-os.org/changeset/33961/haiku

Modified:
   haiku/trunk/src/servers/input/InputServer.cpp
   haiku/trunk/src/servers/registrar/AuthenticationManager.cpp
   haiku/trunk/src/servers/registrar/EventQueue.cpp
   haiku/trunk/src/servers/registrar/MIMEManager.cpp
   haiku/trunk/src/servers/registrar/MessageDeliverer.cpp
   haiku/trunk/src/servers/registrar/Registrar.cpp
   haiku/trunk/src/servers/registrar/ShutdownProcess.cpp
   haiku/trunk/src/system/kernel/device_manager/IOScheduler.cpp
Log:
* Adjusted thread priorities of several system services based on a mail from
  Mikhail Panasyuk: since worker threads often end up with B_NORMAL_PRIORITY,
  it might be a good idea to give system threads a higher priority.
* Minor cleanup (mostly automatic whitespace).


Modified: haiku/trunk/src/servers/input/InputServer.cpp
===================================================================
--- haiku/trunk/src/servers/input/InputServer.cpp       2009-11-09 13:17:47 UTC 
(rev 33960)
+++ haiku/trunk/src/servers/input/InputServer.cpp       2009-11-09 15:25:48 UTC 
(rev 33961)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
+ * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  */
 
@@ -164,6 +164,9 @@
        CALLED();
        gInputServer = this;
 
+       set_thread_priority(find_thread(NULL), B_URGENT_DISPLAY_PRIORITY);
+               // elevate priority for client interaction
+
        _StartEventLoop();
 
        char parameter[32];

Modified: haiku/trunk/src/servers/registrar/AuthenticationManager.cpp
===================================================================
--- haiku/trunk/src/servers/registrar/AuthenticationManager.cpp 2009-11-09 
13:17:47 UTC (rev 33960)
+++ haiku/trunk/src/servers/registrar/AuthenticationManager.cpp 2009-11-09 
15:25:48 UTC (rev 33961)
@@ -180,7 +180,7 @@
 
                if (message.FindInt32("uid", &intValue) == B_OK)
                        fUID = intValue;
-                       
+
                if (message.FindInt32("gid", &intValue) == B_OK)
                        fGID = intValue;
 
@@ -207,22 +207,22 @@
 
                if (message.FindInt32("last changed", &intValue) == B_OK)
                        fLastChanged = intValue;
-                       
+
                if (message.FindInt32("min", &intValue) == B_OK)
                        fMin = intValue;
-                       
+
                if (message.FindInt32("max", &intValue) == B_OK)
                        fMax = intValue;
-                       
+
                if (message.FindInt32("warn", &intValue) == B_OK)
                        fWarn = intValue;
-                       
+
                if (message.FindInt32("inactive", &intValue) == B_OK)
                        fInactive = intValue;
-                       
+
                if (message.FindInt32("expiration", &intValue) == B_OK)
                        fExpiration = intValue;
-                       
+
                if (message.FindInt32("flags", &intValue) == B_OK)
                        fFlags = intValue;
        }
@@ -654,7 +654,7 @@
                return fRequestPort;
 
        fRequestThread = spawn_thread(&_RequestThreadEntry,
-               "authentication manager", B_NORMAL_PRIORITY, this);
+               "authentication manager", B_NORMAL_PRIORITY + 1, this);
        if (fRequestThread < 0)
                return fRequestThread;
 
@@ -947,7 +947,7 @@
                                                        }
                                                }
 
-                                               // replace the old user and 
write DBs to disk 
+                                               // replace the old user and 
write DBs to disk
                                                if (error == B_OK) {
                                                        fUserDB->AddUser(user);
                                                        fUserDB->WriteToDisk();

Modified: haiku/trunk/src/servers/registrar/EventQueue.cpp
===================================================================
--- haiku/trunk/src/servers/registrar/EventQueue.cpp    2009-11-09 13:17:47 UTC 
(rev 33960)
+++ haiku/trunk/src/servers/registrar/EventQueue.cpp    2009-11-09 15:25:48 UTC 
(rev 33961)
@@ -1,42 +1,25 @@
-//------------------------------------------------------------------------------
-//     Copyright (c) 2001-2002, OpenBeOS
-//
-//     Permission is hereby granted, free of charge, to any person obtaining a
-//     copy of this software and associated documentation files (the 
"Software"),
-//     to deal in the Software without restriction, including without 
limitation
-//     the rights to use, copy, modify, merge, publish, distribute, sublicense,
-//     and/or sell copies of the Software, and to permit persons to whom the
-//     Software is furnished to do so, subject to the following conditions:
-//
-//     The above copyright notice and this permission notice shall be included 
in
-//     all copies or substantial portions of the Software.
-//
-//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
OR
-//     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE
-//     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-//     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-//     DEALINGS IN THE SOFTWARE.
-//
-//     File Name:              EventQueue.cpp
-//     Author:                 Ingo Weinhold (bonefish@xxxxxxxxxxxx)
-//                                     YellowBites (http://www.yellowbites.com)
-//     Description:    A class providing a mechanism for executing events at
-//                                     specified times.
-//------------------------------------------------------------------------------
+/*
+ * Copyright 2001-2009, Haiku Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Ingo Weinhold (bonefish@xxxxxxxxxxxx)
+ */
 
+
+#include "EventQueue.h"
+
 #include <stdio.h>
 
 #include <String.h>
 
 #include "Event.h"
-#include "EventQueue.h"
 
+
 static const char *kDefaultEventQueueName = "event looper";
 
-/*!
-       \class EventQueue
+
+/*!    \class EventQueue
        \brief A class providing a mechanism for executing events at specified
                   times.
 
@@ -51,7 +34,7 @@
        method return \c true, the event object is deleted after execution. In
        any case the event is removed from the list before it is executed. The
        queue is not locked while an event is executed.
-       
+
        The event list (\a fEvents) is ordered ascendingly by time. The thread
        uses a semaphore (\a fLooperControl) to wait (time out) for the next
        event. This semaphore is released to indicate changes to the event list.
@@ -88,7 +71,6 @@
 */
 
 
-// constructor
 /*!    \brief Creates a new event queue.
 
        The status of the initialization can and should be check with 
InitCheck().
@@ -97,12 +79,13 @@
                   a default name is used.
 */
 EventQueue::EventQueue(const char *name)
-       : fEvents(100),
-         fEventLooper(-1),
-         fLooperControl(-1),
-         fNextEventTime(0),
-         fStatus(B_ERROR),
-         fTerminating(false)
+       :
+       fEvents(100),
+       fEventLooper(-1),
+       fLooperControl(-1),
+       fNextEventTime(0),
+       fStatus(B_ERROR),
+       fTerminating(false)
 {
        if (!name)
                name = kDefaultEventQueueName;
@@ -112,8 +95,8 @@
        else
                fStatus = fLooperControl;
        if (fStatus == B_OK) {
-               fEventLooper = spawn_thread(_EventLooperEntry, name, 
B_NORMAL_PRIORITY,
-                                                                       this);
+               fEventLooper = spawn_thread(_EventLooperEntry, name,
+                       B_DISPLAY_PRIORITY + 1, this);
                if (fEventLooper >= B_OK) {
                        fStatus = B_OK;
                        resume_thread(fEventLooper);
@@ -122,7 +105,7 @@
        }
 }
 
-// destructor
+
 /*!    \brief Frees all resources associated by this object.
 
        Die() is called to terminate the queue's thread and all events whose
@@ -137,7 +120,7 @@
        }
 }
 
-// InitCheck
+
 /*!    \brief Returns the initialization status of the event queue.
        \return \c B_OK, if everything went fine, an error code otherwise.
 */
@@ -147,7 +130,7 @@
        return fStatus;
 }
 
-// Die
+
 /*!    \brief Terminates the queue's thread.
 
        If an event is currently executed, it is allowed to finish its task
@@ -165,7 +148,7 @@
        }
 }
 
-// AddEvent
+
 /*!    \brief Adds a new event to the queue.
 
        The event's time must be set, before adding it. Afterwards ModifyEvent()
@@ -188,7 +171,7 @@
        return result;
 }
 
-// RemoveEvent
+
 /*!    \brief Removes an event from the queue.
        \param event The event to be removed.
        \return \c true, if the event has been removed successfully, \c false, 
if
@@ -205,7 +188,7 @@
        return result;
 }
 
-// ModifyEvent
+
 /*!    \brief Modifies an event's time.
 
        The event must be in the queue.
@@ -228,7 +211,7 @@
        Unlock();
 }
 
-// _AddEvent
+
 /*!    \brief Adds an event to the event list.
 
        \note The object must be locked when this method is invoked.
@@ -244,7 +227,7 @@
        return fEvents.AddItem(event, index);
 }
 
-// _RemoveEvent
+
 /*!    \brief Removes an event from the event list.
 
        \note The object must be locked when this method is invoked.
@@ -260,7 +243,7 @@
        return (index >= 0 && fEvents.RemoveItem(index));
 }
 
-// _EventAt
+
 /*!    \brief Returns an event from the event list.
 
        \note The object must be locked when this method is invoked.
@@ -274,7 +257,7 @@
        return (Event*)fEvents.ItemAt(index);
 }
 
-// _IndexOfEvent
+
 /*!    \brief Returns the event list index of the supplied event.
 
        \note The object must be locked when this method is invoked.
@@ -299,7 +282,7 @@
        return -1;
 }
 
-// _FindInsertionIndex
+
 /*!    \brief Finds the event list index at which an event with the supplied
                   has to be added.
 
@@ -330,7 +313,7 @@
        return lower;
 }
 
-// _EventLooperEntry
+
 /*!    \brief Entry point from the queue's thread.
        \param data The queue's \c this pointer.
        \return The thread's result. Of no relevance in this case.
@@ -341,7 +324,7 @@
        return ((EventQueue*)data)->_EventLooper();
 }
 
-// _EventLooper
+
 /*!    \brief Method with the main loop of the queue's thread.
        \return The thread's result. Of no relevance in this case.
 */
@@ -385,7 +368,7 @@
        return 0;
 }
 
-// _Reschedule
+
 /*!    \brief To be called, when an event has been added or removed.
 
        Checks whether the queue's thread has to recalculate the time when it
@@ -402,4 +385,3 @@
                        release_sem(fLooperControl);
        }
 }
-

Modified: haiku/trunk/src/servers/registrar/MIMEManager.cpp
===================================================================
--- haiku/trunk/src/servers/registrar/MIMEManager.cpp   2009-11-09 13:17:47 UTC 
(rev 33960)
+++ haiku/trunk/src/servers/registrar/MIMEManager.cpp   2009-11-09 15:25:48 UTC 
(rev 33961)
@@ -1,5 +1,13 @@
-// MIMEManager.cpp
+/*
+ * Copyright 2002-2009, Haiku Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Ingo Weinhold (bonefish@xxxxxxxxxxxx)
+ *             Tyler Dauwalder
+ */
 
+
 #include "MIMEManager.h"
 
 #include <stdio.h>
@@ -19,23 +27,25 @@
 #include "TextSnifferAddon.h"
 #include "UpdateMimeInfoThread.h"
 
+
 using namespace std;
 using namespace BPrivate;
 
-/*!
-       \class MIMEManager
+
+/*!    \class MIMEManager
        \brief MIMEManager handles communication between BMimeType and the 
system-wide
        MimeDatabase object for BMimeType's write and non-atomic read functions.
 
 */
 
-// constructor
+
 /*!    \brief Creates and initializes a MIMEManager.
 */
 MIMEManager::MIMEManager()
-                  : BLooper("main_mime")
-                  , fDatabase()
-                  , fThreadManager()
+       :
+       BLooper("main_mime"),
+       fDatabase(),
+       fThreadManager()
 {
        AddHandler(&fThreadManager);
 
@@ -48,14 +58,14 @@
        }
 }
 
-// destructor
+
 /*!    \brief Frees all resources associate with this object.
 */
 MIMEManager::~MIMEManager()
 {
 }
 
-// MessageReceived
+
 /*!    \brief Overrides the super class version to handle the MIME specific
                   messages.
        \param message The message to be handled
@@ -70,66 +80,65 @@
                case B_REG_MIME_SET_PARAM:
                        HandleSetParam(message);
                        break;
-                       
+
                case B_REG_MIME_DELETE_PARAM:
                        HandleDeleteParam(message);
                        break;
-               
+
                case B_REG_MIME_START_WATCHING:
                case B_REG_MIME_STOP_WATCHING:
                {
                        BMessenger messenger;
                        err = message->FindMessenger("target", &messenger);
                        if (!err) {
-                               err = message->what == 
B_REG_MIME_START_WATCHING 
-                                           ? fDatabase.StartWatching(messenger)
-                                             : 
fDatabase.StopWatching(messenger);
+                               err = message->what == B_REG_MIME_START_WATCHING
+                                       ? fDatabase.StartWatching(messenger)
+                                       : fDatabase.StopWatching(messenger);
                        }
-                       
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
-               
+
                case B_REG_MIME_INSTALL:
                case B_REG_MIME_DELETE:
                {
-                       const char *type;                       
+                       const char *type;
                        err = message->FindString("type", &type);
                        if (!err)
                                err = message->what == B_REG_MIME_INSTALL
-                                           ? fDatabase.Install(type)
-                                             : fDatabase.Delete(type);
-                                             
+                                       ? fDatabase.Install(type) : 
fDatabase.Delete(type);
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
-               
+
                case B_REG_MIME_GET_INSTALLED_TYPES:
                {
                        const char *supertype;
                        err = message->FindString("supertype", &supertype);
-                       if (err == B_NAME_NOT_FOUND) 
+                       if (err == B_NAME_NOT_FOUND)
                                err = fDatabase.GetInstalledTypes(&reply);
-                       else if (!err) 
+                       else if (!err)
                                err = fDatabase.GetInstalledTypes(supertype, 
&reply);
-                               
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
-               
+
                case B_REG_MIME_GET_INSTALLED_SUPERTYPES:
                {
                        err = fDatabase.GetInstalledSupertypes(&reply);
-                               
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
 
@@ -137,28 +146,28 @@
                {
                        const char *type;
                        err = message->FindString("type", &type);
-                       if (!err) 
+                       if (!err)
                                err = fDatabase.GetSupportingApps(type, &reply);
-                               
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
-               
+
                case B_REG_MIME_GET_ASSOCIATED_TYPES:
                {
                        const char *extension;
                        err = message->FindString("extension", &extension);
                        if (!err)
                                err = fDatabase.GetAssociatedTypes(extension, 
&reply);
-                               
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
+                       message->SendReply(&reply, this);
                        break;
                }
-               
+
                case B_REG_MIME_SNIFF:
                {
                        BString str;
@@ -182,31 +191,31 @@
                        }
                        if (!err)
                                err = reply.AddString("mime type", str);
-                                                               
+
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", err);
-                       message->SendReply(&reply, this);                       
        
-                       break;          
+                       message->SendReply(&reply, this);
+                       break;
                }
-               
+
                case B_REG_MIME_CREATE_APP_META_MIME:
                case B_REG_MIME_UPDATE_MIME_INFO:
                {
                        using BPrivate::Storage::Mime::MimeUpdateThread;
                        using BPrivate::Storage::Mime::CreateAppMetaMimeThread;
                        using BPrivate::Storage::Mime::UpdateMimeInfoThread;
-                       
+
                        entry_ref root;
                        bool recursive;
                        bool synchronous = false;
                        int32 force;
-                       
+
                        MimeUpdateThread *thread = NULL;
-                       
+
                        status_t threadStatus = B_NO_INIT;
                        bool messageIsDetached = false;
                        bool stillOwnsThread = true;
-                       
+
                        // Gather our arguments
                        err = message->FindRef("entry", &root);
                        if (!err)
@@ -215,13 +224,13 @@
                                err = message->FindBool("synchronous", 
&synchronous);
                        if (!err)
                                err = message->FindInt32("force", &force);
-                       
-                       // Detach the message for synchronous calls     
+
+                       // Detach the message for synchronous calls
                        if (!err && synchronous) {
                                DetachCurrentMessage();
                                messageIsDetached = true;
                        }
-                       
+
                        // Create the appropriate flavor of mime update thread
                        if (!err) {
                                switch (message->what) {
@@ -229,30 +238,30 @@
                                                thread = new(nothrow) 
CreateAppMetaMimeThread(
                                                        synchronous ? 
"create_app_meta_mime (s)"
                                                                : 
"create_app_meta_mime (a)",
-                                                       B_NORMAL_PRIORITY, 
&fDatabase,
+                                                       B_NORMAL_PRIORITY + 1, 
&fDatabase,
                                                        
BMessenger(&fThreadManager), &root, recursive,
                                                        force, synchronous ? 
message : NULL);
                                                break;
-                                       
+
                                        case B_REG_MIME_UPDATE_MIME_INFO:
                                                thread = new(nothrow) 
UpdateMimeInfoThread(synchronous
                                                                ? 
"update_mime_info (s)"
                                                                : 
"update_mime_info (a)",
-                                                       B_NORMAL_PRIORITY, 
&fDatabase,
+                                                       B_NORMAL_PRIORITY + 1, 
&fDatabase,
                                                        
BMessenger(&fThreadManager), &root, recursive,
                                                        force, synchronous ? 
message : NULL);
                                                break;
-                                               
+
                                        default:
                                                err = B_BAD_VALUE;
-                                               break;                          
        
+                                               break;
                                }
                        }
                        if (!err)
-                               err = thread ? B_OK : B_NO_MEMORY;              
        
+                               err = thread ? B_OK : B_NO_MEMORY;
                        if (!err)
                                err = threadStatus = thread->InitCheck();
-                               
+
                        // Launch the thread
                        if (!err) {
                                err = fThreadManager.LaunchThread(thread);
@@ -260,7 +269,7 @@
                                        stillOwnsThread = false;
                                }
                        }
-                               
+
                        // If something went wrong, we need to notify the 
sender regardless. However,
                        // if this is a synchronous call, we've already 
detached the message, and must
                        // be careful that it gets deleted once and only once. 
Thus, if the MimeUpdateThread
@@ -280,7 +289,7 @@
                                delete thread;
                        break;
                }
-               
+
                default:
                        printf("MIMEMan: msg->what == %lx (%.4s)\n", 
message->what,
                                (char*)&(message->what));
@@ -289,7 +298,7 @@
        }
 }
 
-// HandleSetParam 
+
 //! Handles all B_REG_MIME_SET_PARAM messages
 void
 MIMEManager::HandleSetParam(BMessage *message)
@@ -297,7 +306,7 @@
        status_t err;
        int32 which;
        const char *type;
-       
+
        err = message->FindString("type", &type);
        if (!err)
                err = message->FindInt32("which", &which);
@@ -311,7 +320,7 @@
                                        err = fDatabase.SetAppHint(type, &ref);
                                break;
                        }
-               
+
                        case B_REG_MIME_ATTR_INFO:
                        {
                                BMessage info;
@@ -320,7 +329,7 @@
                                        err = fDatabase.SetAttrInfo(type, 
&info);
                                break;
                        }
-               
+
                        case B_REG_MIME_DESCRIPTION:
                        {
                                bool isLong;
@@ -328,13 +337,14 @@
                                err = message->FindBool("long", &isLong);
                                if (!err)
                                        err = 
message->FindString("description", &description);
-                               if (!err) 
-                                       err = (isLong
-                                                    ? 
fDatabase.SetLongDescription(type, description)
-                                                      : 
fDatabase.SetShortDescription(type, description));
+                               if (!err) {
+                                       err = isLong
+                                               ? 
fDatabase.SetLongDescription(type, description)
+                                               : 
fDatabase.SetShortDescription(type, description);
+                               }
                                break;
                        }
-                       
+
                        case B_REG_MIME_FILE_EXTENSIONS:
                        {
                                BMessage extensions;
@@ -343,32 +353,35 @@
                                        err = fDatabase.SetFileExtensions(type, 
&extensions);
                                break;
                        }
-               
+
                        case B_REG_MIME_ICON:
                        case B_REG_MIME_ICON_FOR_TYPE:
                        {
                                const void *data;
                                ssize_t dataSize;
                                int32 size;
-                               err = message->FindData("icon data", 
B_RAW_TYPE, &data, &dataSize);
+                               err = message->FindData("icon data", 
B_RAW_TYPE, &data,
+                                       &dataSize);
                                if (!err)
                                        err = message->FindInt32("icon size", 
&size);
                                if (which == B_REG_MIME_ICON_FOR_TYPE) {
                                        const char *fileType;
                                        if (!err)
                                                err = message->FindString("file 
type", &fileType);
-                                       if (!err)
-                                               err = size == -1 ?
-                                                       
fDatabase.SetIconForType(type, fileType, data,
-                                                               dataSize) :
-                                                       
fDatabase.SetIconForType(type, fileType, data,
+                                       if (!err) {
+                                               err = size == -1
+                                                       ? 
fDatabase.SetIconForType(type, fileType, data,
+                                                               dataSize)
+                                                       : 
fDatabase.SetIconForType(type, fileType, data,
                                                                dataSize, 
(icon_size)size);
+                                       }
                                } else {
-                                       if (!err) 
-                                               err = size == -1 ?
-                                                       fDatabase.SetIcon(type, 
data, dataSize) :
-                                                       fDatabase.SetIcon(type, 
data, dataSize,
+                                       if (!err) {
+                                               err = size == -1
+                                                       ? 
fDatabase.SetIcon(type, data, dataSize)
+                                                       : 
fDatabase.SetIcon(type, data, dataSize,
                                                                
(icon_size)size);
+                                       }
                                }
                                break;
                                // End temporary fix code
@@ -381,11 +394,13 @@
                                err = message->FindString("signature", 
&signature);
                                if (!err)
                                        err = message->FindInt32("app verb", 
&verb);
-                               if (!err)
-                                       err = fDatabase.SetPreferredApp(type, 
signature, (app_verb)verb);                       
+                               if (!err) {
+                                       err = fDatabase.SetPreferredApp(type, 
signature,
+                                               (app_verb)verb);
+                               }
                                break;
                        }
-                       
+
                        case B_REG_MIME_SNIFFER_RULE:
                        {
                                const char *rule;
@@ -394,7 +409,7 @@
                                        err = fDatabase.SetSnifferRule(type, 
rule);
                                break;
                        }
-                               
+
                        case B_REG_MIME_SUPPORTED_TYPES:
                        {
                                BMessage types;
@@ -406,29 +421,27 @@
                                        err = fDatabase.SetSupportedTypes(type, 
&types, fullSync);
                                break;
                        }
-               
+
                        default:
                                err = B_BAD_VALUE;
-                               break;                          
-               }               
+                               break;
+               }
        }
 
        BMessage reply(B_REG_RESULT);
        reply.AddInt32("result", err);
-       message->SendReply(&reply, this);                               
+       message->SendReply(&reply, this);
 }
 
-// HandleSetParam 
+
 //! Handles all B_REG_MIME_SET_PARAM messages
 void
 MIMEManager::HandleDeleteParam(BMessage *message)
 {
-//     using BPrivate::MimeDatabase;
-
        status_t err;
        int32 which;
        const char *type;
-       
+
        err = message->FindString("type", &type);
        if (!err)
                err = message->FindInt32("which", &which);
@@ -441,21 +454,22 @@
                        case B_REG_MIME_ATTR_INFO:
                                err = fDatabase.DeleteAttrInfo(type);
                                break;
-               
+
                        case B_REG_MIME_DESCRIPTION:
                        {
                                bool isLong;
                                err = message->FindBool("long", &isLong);
-                               if (!err) 
+                               if (!err) {
                                        err = isLong
-                                                   ? 
fDatabase.DeleteLongDescription(type)
-                                                     : 
fDatabase.DeleteShortDescription(type);
+                                               ? 
fDatabase.DeleteLongDescription(type)
+                                               : 
fDatabase.DeleteShortDescription(type);
+                               }
                                break;
                        }
-                       
+
                        case B_REG_MIME_FILE_EXTENSIONS:
                                err = fDatabase.DeleteFileExtensions(type);
-                               break;                  
+                               break;
 
                        case B_REG_MIME_ICON:
                        case B_REG_MIME_ICON_FOR_TYPE:
@@ -466,19 +480,22 @@
                                        const char *fileType;
                                        if (!err)
                                                err = message->FindString("file 
type", &fileType);
-                                       if (!err)
-                                               err = (size == -1) ?
-                                                       
fDatabase.DeleteIconForType(type, fileType) :
-                                                       
fDatabase.DeleteIconForType(type, fileType, (icon_size)size);
+                                       if (!err) {
+                                               err = size == -1
+                                                       ? 
fDatabase.DeleteIconForType(type, fileType)
+                                                       : 
fDatabase.DeleteIconForType(type, fileType,
+                                                               
(icon_size)size);
+                                       }
                                } else {
-                                       if (!err) 
-                                               err = (size == -1) ?
-                                                       
fDatabase.DeleteIcon(type) :
-                                                       
fDatabase.DeleteIcon(type, (icon_size)size);
+                                       if (!err) {
+                                               err = size == -1
+                                                       ? 
fDatabase.DeleteIcon(type)
+                                                       : 
fDatabase.DeleteIcon(type, (icon_size)size);
+                                       }
                                }
                                break;
                        }
-                               
+
                        case B_REG_MIME_PREFERRED_APP:
                        {
                                int32 verb;
@@ -487,10 +504,10 @@
                                        err = 
fDatabase.DeletePreferredApp(type, (app_verb)verb);
                                break;
                        }
-                       
+
                        case B_REG_MIME_SNIFFER_RULE:
                                err = fDatabase.DeleteSnifferRule(type);
-                               break;                  
+                               break;
 
                        case B_REG_MIME_SUPPORTED_TYPES:
                        {
@@ -499,16 +516,16 @@
                                if (!err)
                                        err = 
fDatabase.DeleteSupportedTypes(type, fullSync);
                                break;
-                       }       
+                       }
 
                        default:
                                err = B_BAD_VALUE;
-                               break;                          
-               }               
+                               break;
+               }
        }
 
        BMessage reply(B_REG_RESULT);
        reply.AddInt32("result", err);
-       message->SendReply(&reply, this);                               
+       message->SendReply(&reply, this);
 }
 

Modified: haiku/trunk/src/servers/registrar/MessageDeliverer.cpp
===================================================================
--- haiku/trunk/src/servers/registrar/MessageDeliverer.cpp      2009-11-09 
13:17:47 UTC (rev 33960)
+++ haiku/trunk/src/servers/registrar/MessageDeliverer.cpp      2009-11-09 
15:25:48 UTC (rev 33961)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright 2005, Ingo Weinhold, bonefish@xxxxxxxxxxxxx All rights reserved.
  * Distributed under the terms of the MIT License.
  */
@@ -298,12 +298,12 @@
                fMessage = other.fMessage;
                return *this;
        }
-       
+
        bool operator==(const TargetMessageHandle &other) const
        {
                return (fMessage == other.fMessage);
        }
-       
+
        bool operator!=(const TargetMessageHandle &other) const
        {
                return (fMessage != other.fMessage);
@@ -321,7 +321,7 @@
        }
 
 private:
-       TargetMessage   *fMessage;      
+       TargetMessage   *fMessage;
 };
 
 // TargetPort
@@ -509,7 +509,7 @@
 
        // spawn the deliverer thread
        fDelivererThread = spawn_thread(MessageDeliverer::_DelivererThreadEntry,
-               "message deliverer", B_NORMAL_PRIORITY, this);
+               "message deliverer", B_NORMAL_PRIORITY + 1, this);
        if (fDelivererThread < 0)
                return fDelivererThread;
 
@@ -573,7 +573,7 @@
        \return
        - \c B_OK, if sending the message succeeded or if the target port was
          full and the message has been queued,
-       - another error code otherwise.         
+       - another error code otherwise.
 */
 status_t
 MessageDeliverer::DeliverMessage(BMessage *message, BMessenger target,
@@ -597,7 +597,7 @@
        \return
        - \c B_OK, if for each of the given targets sending the message 
succeeded
          or if the target port was full and the message has been queued,
-       - another error code otherwise.         
+       - another error code otherwise.
 */
 status_t
 MessageDeliverer::DeliverMessage(BMessage *message, MessagingTargetSet 
&targets,
@@ -632,7 +632,7 @@
        \return
        - \c B_OK, if for each of the given targets sending the message 
succeeded
          or if the target port was full and the message has been queued,
-       - another error code otherwise.         
+       - another error code otherwise.
 */
 status_t
 MessageDeliverer::DeliverMessage(const void *messageData, int32 messageSize,
@@ -706,7 +706,7 @@
 
        if (!create)
                return NULL;
-       
+
        // create a port
        TargetPort *port = new(nothrow) TargetPort(portID);
        if (!port)

Modified: haiku/trunk/src/servers/registrar/Registrar.cpp
===================================================================
--- haiku/trunk/src/servers/registrar/Registrar.cpp     2009-11-09 13:17:47 UTC 
(rev 33960)
+++ haiku/trunk/src/servers/registrar/Registrar.cpp     2009-11-09 15:25:48 UTC 
(rev 33961)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
+ * Copyright 2001-2009, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -54,7 +54,8 @@
                   error code.
 */
 Registrar::Registrar(status_t *error)
-       : BServer(kRegistrarSignature, false, error),
+       :
+       BServer(kRegistrarSignature, false, error),
        fRoster(NULL),
        fClipboardHandler(NULL),
        fMIMEManager(NULL),
@@ -65,9 +66,11 @@
        fAuthenticationManager(NULL)
 {
        FUNCTION_START();
+
+       set_thread_priority(find_thread(NULL), B_NORMAL_PRIORITY + 1);
 }
 
-// destructor
+
 /*!    \brief Frees all resources associated with the registrar.

[... truncated: 147 lines follow ...]

Other related posts:

  • » [haiku-commits] r33961 - in haiku/trunk/src: servers/input servers/registrar system/kernel/device_manager - axeld