xpcom/threads/nsThreadPool.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsThreadPool_h__
michael@0 8 #define nsThreadPool_h__
michael@0 9
michael@0 10 #include "nsIThreadPool.h"
michael@0 11 #include "nsIThread.h"
michael@0 12 #include "nsIRunnable.h"
michael@0 13 #include "nsEventQueue.h"
michael@0 14 #include "nsCOMArray.h"
michael@0 15 #include "nsCOMPtr.h"
michael@0 16 #include "nsThreadUtils.h"
michael@0 17 #include "mozilla/Attributes.h"
michael@0 18
michael@0 19 class nsThreadPool MOZ_FINAL : public nsIThreadPool,
michael@0 20 public nsIRunnable
michael@0 21 {
michael@0 22 public:
michael@0 23 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 24 NS_DECL_NSIEVENTTARGET
michael@0 25 NS_DECL_NSITHREADPOOL
michael@0 26 NS_DECL_NSIRUNNABLE
michael@0 27
michael@0 28 nsThreadPool();
michael@0 29
michael@0 30 private:
michael@0 31 ~nsThreadPool();
michael@0 32
michael@0 33 void ShutdownThread(nsIThread *thread);
michael@0 34 nsresult PutEvent(nsIRunnable *event);
michael@0 35
michael@0 36 nsCOMArray<nsIThread> mThreads;
michael@0 37 nsEventQueue mEvents;
michael@0 38 uint32_t mThreadLimit;
michael@0 39 uint32_t mIdleThreadLimit;
michael@0 40 uint32_t mIdleThreadTimeout;
michael@0 41 uint32_t mIdleCount;
michael@0 42 uint32_t mStackSize;
michael@0 43 nsCOMPtr<nsIThreadPoolListener> mListener;
michael@0 44 bool mShutdown;
michael@0 45 nsCString mName;
michael@0 46 nsThreadPoolNaming mThreadNaming;
michael@0 47 };
michael@0 48
michael@0 49 #define NS_THREADPOOL_CID \
michael@0 50 { /* 547ec2a8-315e-4ec4-888e-6e4264fe90eb */ \
michael@0 51 0x547ec2a8, \
michael@0 52 0x315e, \
michael@0 53 0x4ec4, \
michael@0 54 {0x88, 0x8e, 0x6e, 0x42, 0x64, 0xfe, 0x90, 0xeb} \
michael@0 55 }
michael@0 56
michael@0 57 #endif // nsThreadPool_h__

mercurial