haiku/src/servers/registrar/MessagingService.h
Ingo Weinhold 9e4d0f686e The beginning of the registrar-side kernel->userland messaging service.
The passing of commands from kernel to registrar should be complete now,
only the actual message delivery is missing.
Completely untested yet.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10995 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-24 01:26:39 +00:00

65 lines
1.2 KiB
C++

/*
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef MESSAGING_SERVICE_H
#define MESSAGING_SERVICE_H
#include <MessagingServiceDefs.h>
// MessagingArea
class MessagingArea {
public:
~MessagingArea();
static status_t Create(area_id kernelAreaID, sem_id lockSem,
sem_id counterSem, MessagingArea *&area);
bool Lock();
void Unlock();
area_id ID() const;
int32 Size() const;
int32 CountCommands() const;
const messaging_command *PopCommand();
void Discard();
area_id NextKernelAreaID() const;
void SetNextArea(MessagingArea *area);
MessagingArea *NextArea() const;
private:
MessagingArea();
messaging_area_header *fHeader;
area_id fID;
int32 fSize;
sem_id fLockSem;
sem_id fCounterSem; // TODO: Remove, if not needed.
MessagingArea *fNextArea;
};
// MessagingService
class MessagingService {
public:
MessagingService();
~MessagingService();
status_t Init();
private:
static int32 _CommandProcessorEntry(void *data);
int32 _CommandProcessor();
sem_id fLockSem;
sem_id fCounterSem;
MessagingArea *fFirstArea;
thread_id fCommandProcessor;
volatile bool fTerminating;
};
#endif // MESSAGING_SERVICE_H