X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Facess.h;h=1f969f8a2b128b3cce21285d2ce00a720b1d8373;hb=e5e272c426a28f2f9e69ed2232469575c7409af1;hp=861fd3011affaf696d9f7bddf0082dbd298dc228;hpb=b5a1402b18d2f8cb360bf2fc524609b374bac8ec;p=tpg%2Facess2.git diff --git a/Kernel/include/acess.h b/Kernel/include/acess.h index 861fd301..1f969f8a 100644 --- a/Kernel/include/acess.h +++ b/Kernel/include/acess.h @@ -22,14 +22,24 @@ typedef Uint tGID; typedef Sint64 tTimestamp; typedef struct sShortSpinlock tShortSpinlock; typedef struct sMutex tMutex; +typedef struct sSemaphore tSemaphore; struct sMutex { tShortSpinlock Protector; //!< Protector for the lock strucure + const char *Name; //!< Human-readable name struct sThread *volatile Owner; //!< Owner of the lock (set upon getting the lock) struct sThread *Waiting; //!< Waiting threads struct sThread *LastWaiting; //!< Waiting threads }; +struct sSemaphore { + tShortSpinlock Protector; //!< Protector for the lock strucure + const char *Name; //!< Human-readable name + volatile int Value; //!< Current mutex value + struct sThread *Waiting; //!< Waiting threads + struct sThread *LastWaiting; //!< Waiting threads +}; + // --- Helper Macros --- /** * \name Helper Macros @@ -123,16 +133,16 @@ extern void Log_Debug(char *Ident, char *Message, ...); * \{ */ extern void Debug_KernelPanic(void); //!< Initiate a kernel panic -extern void Panic(char *Msg, ...); //!< Print a panic message (initiates a kernel panic) -extern void Warning(char *Msg, ...); //!< Print a warning message -extern void LogF(char *Fmt, ...); //!< Print a log message without a trailing newline -extern void Log(char *Fmt, ...); //!< Print a log message -extern void Debug(char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm) -extern void LogV(char *Fmt, va_list Args); //!< va_list Log message -extern void Debug_Enter(char *FuncName, char *ArgTypes, ...); -extern void Debug_Log(char *FuncName, char *Fmt, ...); -extern void Debug_Leave(char *FuncName, char RetType, ...); -extern void Debug_HexDump(char *Header, void *Data, Uint Length); +extern void Panic(const char *Msg, ...); //!< Print a panic message (initiates a kernel panic) +extern void Warning(const char *Msg, ...); //!< Print a warning message +extern void LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline +extern void Log(const char *Fmt, ...); //!< Print a log message +extern void Debug(const char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm) +extern void LogV(const char *Fmt, va_list Args); //!< va_list Log message +extern void Debug_Enter(const char *FuncName, const char *ArgTypes, ...); +extern void Debug_Log(const char *FuncName, const char *Fmt, ...); +extern void Debug_Leave(const char *FuncName, char RetType, ...); +extern void Debug_HexDump(const char *Header, const void *Data, Uint Length); #define UNIMPLEMENTED() Warning("'%s' unimplemented", __func__) #if DEBUG # define ENTER(_types...) Debug_Enter((char*)__func__, _types)