diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llcommon/llqueuedthread.h | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/llqueuedthread.h | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/linden/indra/llcommon/llqueuedthread.h b/linden/indra/llcommon/llqueuedthread.h index cc21b3b..7231285 100644 --- a/linden/indra/llcommon/llqueuedthread.h +++ b/linden/indra/llcommon/llqueuedthread.h | |||
@@ -52,7 +52,8 @@ public: | |||
52 | PRIORITY_HIGH = 0x30000000, | 52 | PRIORITY_HIGH = 0x30000000, |
53 | PRIORITY_NORMAL = 0x20000000, | 53 | PRIORITY_NORMAL = 0x20000000, |
54 | PRIORITY_LOW = 0x10000000, | 54 | PRIORITY_LOW = 0x10000000, |
55 | PRIORITY_LOWBITS = 0x0FFFFFFF | 55 | PRIORITY_LOWBITS = 0x0FFFFFFF, |
56 | PRIORITY_HIGHBITS = 0x70000000 | ||
56 | }; | 57 | }; |
57 | enum status_t { | 58 | enum status_t { |
58 | STATUS_EXPIRED = -1, | 59 | STATUS_EXPIRED = -1, |
@@ -60,13 +61,13 @@ public: | |||
60 | STATUS_QUEUED = 1, | 61 | STATUS_QUEUED = 1, |
61 | STATUS_INPROGRESS = 2, | 62 | STATUS_INPROGRESS = 2, |
62 | STATUS_COMPLETE = 3, | 63 | STATUS_COMPLETE = 3, |
63 | STATUS_ABORT = 4, | 64 | STATUS_ABORTED = 4, |
64 | STATUS_ABORTED = 5, | 65 | STATUS_DELETE = 5 |
65 | STATUS_DELETE = 6 | ||
66 | }; | 66 | }; |
67 | enum flags_t { | 67 | enum flags_t { |
68 | AUTO_COMPLETE = 1, | 68 | FLAG_AUTO_COMPLETE = 1, |
69 | AUTO_DELETE = 2 // child-class dependent | 69 | FLAG_AUTO_DELETE = 2, // child-class dependent |
70 | FLAG_ABORT = 4 | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | typedef U32 handle_t; | 73 | typedef U32 handle_t; |
@@ -79,7 +80,7 @@ public: | |||
79 | friend class LLQueuedThread; | 80 | friend class LLQueuedThread; |
80 | 81 | ||
81 | protected: | 82 | protected: |
82 | ~QueuedRequest(); // use deleteRequest() | 83 | virtual ~QueuedRequest(); // use deleteRequest() |
83 | 84 | ||
84 | public: | 85 | public: |
85 | QueuedRequest(handle_t handle, U32 priority, U32 flags = 0); | 86 | QueuedRequest(handle_t handle, U32 priority, U32 flags = 0); |
@@ -111,26 +112,14 @@ public: | |||
111 | mStatus = newstatus; | 112 | mStatus = newstatus; |
112 | return oldstatus; | 113 | return oldstatus; |
113 | } | 114 | } |
114 | status_t abortRequest(U32 flags) | 115 | void setFlags(U32 flags) |
115 | { | 116 | { |
116 | // NOTE: flags are |'d | 117 | // NOTE: flags are |'d |
117 | if (mStatus == STATUS_QUEUED) | ||
118 | { | ||
119 | setStatus(STATUS_ABORT); | ||
120 | } | ||
121 | mFlags |= flags; | 118 | mFlags |= flags; |
122 | status_t status = mStatus; | ||
123 | return status; | ||
124 | } | ||
125 | status_t setFlags(U32 flags) | ||
126 | { | ||
127 | // NOTE: flags are |'d | ||
128 | mFlags |= flags; | ||
129 | status_t status = mStatus; | ||
130 | return status; | ||
131 | } | 119 | } |
132 | 120 | ||
133 | virtual void finishRequest(); // Always called when after has been processed | 121 | virtual bool processRequest() = 0; // Return true when request has completed |
122 | virtual void finishRequest(bool completed); // Always called from thread after request has completed or aborted | ||
134 | virtual void deleteRequest(); // Only method to delete a request | 123 | virtual void deleteRequest(); // Only method to delete a request |
135 | 124 | ||
136 | void setPriority(U32 pri) | 125 | void setPriority(U32 pri) |
@@ -160,9 +149,10 @@ public: | |||
160 | static handle_t nullHandle() { return handle_t(0); } | 149 | static handle_t nullHandle() { return handle_t(0); } |
161 | 150 | ||
162 | public: | 151 | public: |
163 | LLQueuedThread(const std::string& name, bool threaded = TRUE, bool runalways = TRUE); | 152 | LLQueuedThread(const std::string& name, bool threaded = true); |
164 | virtual ~LLQueuedThread(); | 153 | virtual ~LLQueuedThread(); |
165 | 154 | virtual void shutdown(); | |
155 | |||
166 | private: | 156 | private: |
167 | // No copy constructor or copy assignment | 157 | // No copy constructor or copy assignment |
168 | LLQueuedThread(const LLQueuedThread&); | 158 | LLQueuedThread(const LLQueuedThread&); |
@@ -174,26 +164,25 @@ private: | |||
174 | protected: | 164 | protected: |
175 | handle_t generateHandle(); | 165 | handle_t generateHandle(); |
176 | bool addRequest(QueuedRequest* req); | 166 | bool addRequest(QueuedRequest* req); |
177 | int processNextRequest(void); | 167 | S32 processNextRequest(void); |
168 | void incQueue(); | ||
178 | 169 | ||
179 | virtual bool processRequest(QueuedRequest* req) = 0; | ||
180 | |||
181 | public: | 170 | public: |
182 | bool waitForResult(handle_t handle, bool auto_complete = true); | 171 | bool waitForResult(handle_t handle, bool auto_complete = true); |
183 | 172 | ||
184 | void update(U32 ms_elapsed); | 173 | virtual S32 update(U32 max_time_ms); |
185 | void updateQueue(S32 inc); | 174 | S32 updateQueue(U32 max_time_ms); |
175 | |||
186 | void waitOnPending(); | 176 | void waitOnPending(); |
187 | void printQueueStats(); | 177 | void printQueueStats(); |
188 | 178 | ||
189 | S32 getPending(bool child_thread = false); | 179 | S32 getPending(); |
190 | bool getThreaded() { return mThreaded ? true : false; } | 180 | bool getThreaded() { return mThreaded ? true : false; } |
191 | bool getRunAlways() { return mRunAlways ? true : false; } | ||
192 | 181 | ||
193 | // Request accessors | 182 | // Request accessors |
194 | status_t getRequestStatus(handle_t handle); | 183 | status_t getRequestStatus(handle_t handle); |
195 | status_t abortRequest(handle_t handle, U32 flags = 0); | 184 | void abortRequest(handle_t handle, bool autocomplete); |
196 | status_t setFlags(handle_t handle, U32 flags); | 185 | void setFlags(handle_t handle, U32 flags); |
197 | void setPriority(handle_t handle, U32 priority); | 186 | void setPriority(handle_t handle, U32 priority); |
198 | bool completeRequest(handle_t handle); | 187 | bool completeRequest(handle_t handle); |
199 | // This is public for support classes like LLWorkerThread, | 188 | // This is public for support classes like LLWorkerThread, |
@@ -205,7 +194,6 @@ public: | |||
205 | 194 | ||
206 | protected: | 195 | protected: |
207 | BOOL mThreaded; // if false, run on main thread and do updates during update() | 196 | BOOL mThreaded; // if false, run on main thread and do updates during update() |
208 | BOOL mRunAlways; // if false, only wake the threads when updateClass() is called | ||
209 | LLAtomic32<BOOL> mIdleThread; // request queue is empty (or we are quitting) and the thread is idle | 197 | LLAtomic32<BOOL> mIdleThread; // request queue is empty (or we are quitting) and the thread is idle |
210 | 198 | ||
211 | typedef std::set<QueuedRequest*, queued_request_less> request_queue_t; | 199 | typedef std::set<QueuedRequest*, queued_request_less> request_queue_t; |