From 9707409e4d15eadac9b3c752c3c6877788943a58 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 25 Nov 2001 23:50:14 +0000 Subject: Wow, everything almost work!!! Amazing!!! --- include/Exceptions.h | 10 +++++----- include/Handle.h | 4 ++-- include/String.h | 2 +- include/Task.h | 7 +++++-- include/TaskMan.h | 4 +++- 5 files changed, 16 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/Exceptions.h b/include/Exceptions.h index 052002e..090ace9 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -45,13 +45,13 @@ class String; class Base { public: - char * strdup(const char * s) const { + static char * strdup(const char * s) { return xstrdup(s); } - void * malloc(ssize_t s) const { + static void * malloc(ssize_t s) { return xmalloc(s); } - void * realloc(void * p, size_t s) const { + static void * realloc(void * p, size_t s) { return xrealloc(p, s); } void * operator new(size_t s) { @@ -63,10 +63,10 @@ class Base { void operator delete(void * p) { xfree(p); } - void free(void *& p) const { + static void free(void *& p) { xfree(p); } - void free(char *& p) const { + static void free(char *& p) { xfree((void *) p); } }; diff --git a/include/Handle.h b/include/Handle.h index 237adff..14eb92d 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -36,11 +36,11 @@ class Handle : public Base { virtual bool CanRead(); virtual bool CanWrite(); virtual String GetName(); + void close(); + int GetHandle(); protected: Handle(int h); - int GetHandle(); - void close(); private: int h; bool closed, nonblock; diff --git a/include/String.h b/include/String.h index 94faa54..0e8372f 100644 --- a/include/String.h +++ b/include/String.h @@ -80,7 +80,7 @@ class String : public Base { private: String(int hs, const char *); - static char t[BUFSIZ]; + static char t[]; char * str; size_t siz; }; diff --git a/include/Task.h b/include/Task.h index cdc51c0..f80258d 100644 --- a/include/Task.h +++ b/include/Task.h @@ -13,6 +13,8 @@ #define TASK_BURST 2 #define W4_STICKY 1 +#define W4_READING 2 +#define W4_WRITING 4 class Task : public Base { public: @@ -21,11 +23,12 @@ class Task : public Base { virtual String GetName(); int Run(); int GetState(); - void Suspend() throw (GeneralException); + void Suspend(int = -1) throw (GeneralException); void WaitFor(Task *); void WaitFor(Handle *, int = 0); void WaitFor(pid_t); void WaitFor(timeval, int = 0); + Task * WaitedBy(); void SetBurst(); void SetCleanUp(); bool HasToClean(); @@ -48,7 +51,7 @@ class Task : public Base { bool stopped; bool cleanup; bool suspended; - vector wbta; + Task * wbta; }; #else diff --git a/include/TaskMan.h b/include/TaskMan.h index e649956..03c0681 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -7,7 +7,9 @@ class TaskMan : public Base { public: - static int AddTask(Task *); + static void AddTask(Task *); + static vector::iterator FindTask(Task *); + static void RemoveFromWatches(Task *); static void Init() throw (GeneralException); static void MainLoop() throw (GeneralException); static void WaitFor(Handle *, Task *, int = 0); -- cgit v1.2.3