* 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).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33961 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-11-09 15:25:48 +00:00
parent 66570f5d3b
commit a0439d88df
8 changed files with 208 additions and 203 deletions
+4 -1
View File
@@ -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 @@ InputServer::InputServer()
CALLED();
gInputServer = this;
set_thread_priority(find_thread(NULL), B_URGENT_DISPLAY_PRIORITY);
// elevate priority for client interaction
_StartEventLoop();
char parameter[32];
@@ -180,7 +180,7 @@ public:
if (message.FindInt32("uid", &intValue) == B_OK)
fUID = intValue;
if (message.FindInt32("gid", &intValue) == B_OK)
fGID = intValue;
@@ -207,22 +207,22 @@ public:
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 @@ AuthenticationManager::Init()
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 @@ AuthenticationManager::_RequestThread()
}
}
// 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();
+37 -55
View File
@@ -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 ([email protected])
// 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@users.sf.net)
*/
#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 @@ static const char *kDefaultEventQueueName = "event looper";
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 @@ static const char *kDefaultEventQueueName = "event looper";
*/
// constructor
/*! \brief Creates a new event queue.
The status of the initialization can and should be check with InitCheck().
@@ -97,12 +79,13 @@ static const char *kDefaultEventQueueName = "event looper";
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 @@ EventQueue::EventQueue(const char *name)
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 @@ EventQueue::EventQueue(const char *name)
}
}
// 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 @@ EventQueue::~EventQueue()
}
}
// 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 @@ EventQueue::InitCheck()
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 @@ EventQueue::Die()
}
}
// 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 @@ EventQueue::AddEvent(Event *event)
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 @@ EventQueue::RemoveEvent(Event *event)
return result;
}
// ModifyEvent
/*! \brief Modifies an event's time.
The event must be in the queue.
@@ -228,7 +211,7 @@ EventQueue::ModifyEvent(Event *event, bigtime_t newTime)
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 @@ EventQueue::_AddEvent(Event *event)
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 @@ EventQueue::_RemoveEvent(Event *event)
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 @@ EventQueue::_EventAt(int32 index) const
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 @@ EventQueue::_IndexOfEvent(Event *event) const
return -1;
}
// _FindInsertionIndex
/*! \brief Finds the event list index at which an event with the supplied
has to be added.
@@ -330,7 +313,7 @@ EventQueue::_FindInsertionIndex(bigtime_t time) const
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 @@ EventQueue::_EventLooperEntry(void *data)
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 @@ EventQueue::_EventLooper()
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 @@ EventQueue::_Reschedule()
release_sem(fLooperControl);
}
}
+127 -110
View File
@@ -1,4 +1,12 @@
// MIMEManager.cpp
/*
* Copyright 2002-2009, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold (bonefish@users.sf.net)
* Tyler Dauwalder
*/
#include "MIMEManager.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 @@ MIMEManager::MIMEManager()
}
}
// 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 @@ MIMEManager::MessageReceived(BMessage *message)
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 @@ MIMEManager::MessageReceived(BMessage *message)
{
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 @@ MIMEManager::MessageReceived(BMessage *message)
}
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 @@ MIMEManager::MessageReceived(BMessage *message)
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 @@ MIMEManager::MessageReceived(BMessage *message)
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 @@ MIMEManager::MessageReceived(BMessage *message)
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 @@ MIMEManager::MessageReceived(BMessage *message)
delete thread;
break;
}
default:
printf("MIMEMan: msg->what == %lx (%.4s)\n", message->what,
(char*)&(message->what));
@@ -289,7 +298,7 @@ MIMEManager::MessageReceived(BMessage *message)
}
}
// HandleSetParam
//! Handles all B_REG_MIME_SET_PARAM messages
void
MIMEManager::HandleSetParam(BMessage *message)
@@ -297,7 +306,7 @@ MIMEManager::HandleSetParam(BMessage *message)
status_t err;
int32 which;
const char *type;
err = message->FindString("type", &type);
if (!err)
err = message->FindInt32("which", &which);
@@ -311,7 +320,7 @@ MIMEManager::HandleSetParam(BMessage *message)
err = fDatabase.SetAppHint(type, &ref);
break;
}
case B_REG_MIME_ATTR_INFO:
{
BMessage info;
@@ -320,7 +329,7 @@ MIMEManager::HandleSetParam(BMessage *message)
err = fDatabase.SetAttrInfo(type, &info);
break;
}
case B_REG_MIME_DESCRIPTION:
{
bool isLong;
@@ -328,13 +337,14 @@ MIMEManager::HandleSetParam(BMessage *message)
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 @@ MIMEManager::HandleSetParam(BMessage *message)
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 @@ MIMEManager::HandleSetParam(BMessage *message)
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 @@ MIMEManager::HandleSetParam(BMessage *message)
err = fDatabase.SetSnifferRule(type, rule);
break;
}
case B_REG_MIME_SUPPORTED_TYPES:
{
BMessage types;
@@ -406,29 +421,27 @@ MIMEManager::HandleSetParam(BMessage *message)
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 @@ MIMEManager::HandleDeleteParam(BMessage *message)
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 @@ MIMEManager::HandleDeleteParam(BMessage *message)
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 @@ MIMEManager::HandleDeleteParam(BMessage *message)
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 @@ MIMEManager::HandleDeleteParam(BMessage *message)
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);
}
+9 -9
View File
@@ -1,4 +1,4 @@
/*
/*
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -298,12 +298,12 @@ public:
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 @@ public:
}
private:
TargetMessage *fMessage;
TargetMessage *fMessage;
};
// TargetPort
@@ -509,7 +509,7 @@ MessageDeliverer::Init()
// 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 @@ MessageDeliverer::Default()
\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 @@ MessageDeliverer::DeliverMessage(BMessage *message, BMessenger target,
\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 @@ MessageDeliverer::DeliverMessage(BMessage *message, MessagingTargetSet &targets,
\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 @@ MessageDeliverer::_GetTargetPort(port_id portID, bool create)
if (!create)
return NULL;
// create a port
TargetPort *port = new(nothrow) TargetPort(portID);
if (!port)
+17 -14
View File
@@ -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 @@ static const bigtime_t kRosterSanityEventInterval = 1000000LL;
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 @@ Registrar::Registrar(status_t *error)
fAuthenticationManager(NULL)
{
FUNCTION_START();
set_thread_priority(find_thread(NULL), B_NORMAL_PRIORITY + 1);
}
// destructor
/*! \brief Frees all resources associated with the registrar.
All registrar services, that haven't been shut down earlier, are
@@ -93,7 +96,7 @@ Registrar::~Registrar()
FUNCTION_END();
}
// MessageReceived
/*! \brief Overrides the super class version to dispatch roster specific
messages.
\param message The message to be handled
@@ -114,7 +117,7 @@ Registrar::MessageReceived(BMessage *message)
}
}
// ReadyToRun
/*! \brief Overrides the super class version to initialize the registrar
services.
*/
@@ -164,14 +167,14 @@ Registrar::ReadyToRun()
// create and schedule the sanity message event
fSanityEvent = new MessageEvent(system_time() + kRosterSanityEventInterval,
this, B_REG_ROSTER_SANITY_EVENT);
this, B_REG_ROSTER_SANITY_EVENT);
fSanityEvent->SetAutoDelete(false);
fEventQueue->AddEvent(fSanityEvent);
FUNCTION_END();
}
// QuitRequested
/*! \brief Overrides the super class version to avoid termination of the
registrar until the system shutdown.
*/
@@ -183,7 +186,7 @@ Registrar::QuitRequested()
return BApplication::QuitRequested();
}
// GetEventQueue
/*! \brief Returns the registrar's event queue.
\return The registrar's event queue.
*/
@@ -193,7 +196,7 @@ Registrar::GetEventQueue() const
return fEventQueue;
}
// App
/*! \brief Returns the Registrar application object.
\return The Registrar application object.
*/
@@ -203,7 +206,7 @@ Registrar::App()
return dynamic_cast<Registrar*>(be_app);
}
// _MessageReceived
void
Registrar::_MessageReceived(BMessage *message)
{
@@ -283,7 +286,7 @@ Registrar::_MessageReceived(BMessage *message)
break;
case B_REG_STOP_WATCHING:
fRoster->HandleStopWatching(message);
break;
break;
case B_REG_GET_RECENT_DOCUMENTS:
fRoster->HandleGetRecentDocuments(message);
break;
@@ -352,7 +355,7 @@ Registrar::_MessageReceived(BMessage *message)
}
}
// _HandleShutDown
/*! \brief Handle a shut down request message.
\param request The request to be handled.
*/
@@ -414,7 +417,7 @@ main()
// rename the main thread
rename_thread(find_thread(NULL), kRosterThreadName);
PRINT(("app->Run()...\n"));
PRINT(("app->Run()...\n"));
try {
app->Run();
@@ -427,7 +430,7 @@ PRINT(("app->Run()...\n"));
debugger("registrar main() caught unknown exception");
}
PRINT(("delete app...\n"));
PRINT(("delete app...\n"));
delete app;
FUNCTION_END();
+2 -2
View File
@@ -695,8 +695,8 @@ ShutdownProcess::Init(BMessage* request)
}
// start the worker thread
fWorker = spawn_thread(_WorkerEntry, "shutdown worker", B_NORMAL_PRIORITY,
this);
fWorker = spawn_thread(_WorkerEntry, "shutdown worker",
B_NORMAL_PRIORITY + 1, this);
if (fWorker < 0) {
fRoster->RemoveWatcher(this);
fRoster->SetShuttingDown(false);
@@ -1,6 +1,6 @@
/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
@@ -182,14 +182,14 @@ IOScheduler::Init(const char* name)
strlcpy(buffer, name, sizeof(buffer));
strlcat(buffer, " scheduler", sizeof(buffer));
fSchedulerThread = spawn_kernel_thread(&_SchedulerThread, buffer,
B_NORMAL_PRIORITY, (void *)this);
B_NORMAL_PRIORITY + 2, (void *)this);
if (fSchedulerThread < B_OK)
return fSchedulerThread;
strlcpy(buffer, name, sizeof(buffer));
strlcat(buffer, " notifier", sizeof(buffer));
fRequestNotifierThread = spawn_kernel_thread(&_RequestNotifierThread,
buffer, B_NORMAL_PRIORITY, (void *)this);
buffer, B_NORMAL_PRIORITY + 2, (void *)this);
if (fRequestNotifierThread < B_OK)
return fRequestNotifierThread;