/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2012-2014, Tomasz Sowa * All rights reserved. * */ #ifndef headerfile_winix_core_jobs #define headerfile_winix_core_jobs #include #include #include "basethread.h" #include "space/space.h" namespace Winix { #define WINIX_JOBS_HOW_MANY_PRIORITIES 32 class Job : public BaseThread { public: Job(); /* add a new job to the queue priority: 0-31 (0 - the lowest priority, 31 - the highest priority) */ void Add(PT::Space & job, int priority = 0); /* queue size, and size of all jobs in any priority */ size_t Size(int priority) const; size_t Size() const; /* true if specified queue is empty or if all queues are empty */ bool Empty(int priority) const; bool Empty() const; private: typedef std::queue JobsQueue; typedef std::vector JobsQueueTab; JobsQueueTab jobs_queue_tab; void CheckPriority(int & priority) const; void SaveToFile(); void ReadFromFile(); /* second thread */ // standard winix jobs // Image image; // sending emails // etc. bool SignalReceived(); void Do(); void DoQueue(JobsQueue & jobs_queue); void DoJob(PT::Space & job); void DoWinixJob(PT::Space & job); }; } // namespace Winix #endif