bug 715586: checksums.py should generate sha1 and md5 checksums. r=catlee,ted
[gecko.git] / xpcom / threads / nsIThreadPool.idl
blob7e27d47efcb14cc68b8c83b83cc37960e961cae3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is Mozilla code.
18 * The Initial Developer of the Original Code is Google Inc.
19 * Portions created by the Initial Developer are Copyright (C) 2006
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Darin Fisher <darin@meer.net>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsIEventTarget.idl"
41 [scriptable, uuid(ef194cab-3f86-4b61-b132-e5e96a79e5d1)]
42 interface nsIThreadPoolListener : nsISupports
44 /**
45 * Called when a new thread is created by the thread pool. The notification
46 * happens on the newly-created thread.
48 void onThreadCreated();
50 /**
51 * Called when a thread is about to be destroyed by the thread pool. The
52 * notification happens on the thread that is about to be destroyed.
54 void onThreadShuttingDown();
57 /**
58 * An interface to a thread pool. A thread pool creates a limited number of
59 * anonymous (unnamed) worker threads. An event dispatched to the thread pool
60 * will be run on the next available worker thread.
62 [scriptable, uuid(d628159b-1a03-4985-aa77-43122eb23bfc)]
63 interface nsIThreadPool : nsIEventTarget
65 /**
66 * Shutdown the thread pool. This method may not be executed from any thread
67 * in the thread pool. Instead, it is meant to be executed from another
68 * thread (usually the thread that created this thread pool). When this
69 * function returns, the thread pool and all of its threads will be shutdown,
70 * and it will no longer be possible to dispatch tasks to the thread pool.
72 void shutdown();
74 /**
75 * Get/set the maximum number of threads allowed at one time in this pool.
76 */
77 attribute unsigned long threadLimit;
79 /**
80 * Get/set the maximum number of idle threads kept alive.
82 attribute unsigned long idleThreadLimit;
84 /**
85 * Get/set the amount of time in milliseconds before an idle thread is
86 * destroyed.
88 attribute unsigned long idleThreadTimeout;
90 /**
91 * An optional listener that will be notified when a thread is created or
92 * destroyed in the course of the thread pool's operation.
94 * A listener will only receive notifications about threads created after the
95 * listener is set so it is recommended that the consumer set the listener
96 * before dispatching the first event. A listener that receives an
97 * onThreadCreated() notification is guaranteed to always receive the
98 * corresponding onThreadShuttingDown() notification.
100 * The thread pool takes ownership of the listener and releases it when the
101 * shutdown() method is called. Threads created after the listener is set will
102 * also take ownership of the listener so that the listener will be kept alive
103 * long enough to receive the guaranteed onThreadShuttingDown() notification.
105 attribute nsIThreadPoolListener listener;