Bug 434602 - After being open a few minutes, large parts of the screen don't repaint...
[mozilla-1.9.git] / xpcom / threads / nsIThread.idl
blob8261f2d7b1ffe4a34092d652b59d5052efeb8a46
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 [ptr] native PRThread(PRThread);
43 /**
44 * This interface provides a high-level abstraction for an operating system
45 * thread.
47 * Threads have a built-in event queue, and a thread is an event target that
48 * can receive nsIRunnable objects (events) to be processed on the thread.
50 * See nsIThreadManager for the API used to create and locate threads.
52 [scriptable, uuid(9c889946-a73a-4af3-ae9a-ea64f7d4e3ca)]
53 interface nsIThread : nsIEventTarget
55 /**
56 * @returns
57 * The NSPR thread object corresponding to this nsIThread.
59 [noscript] readonly attribute PRThread PRThread;
61 /**
62 * Shutdown the thread. This method prevents further dispatch of events to
63 * the thread, and it causes any pending events to run to completion before
64 * the thread joins (see PR_JoinThread) with the current thread. During this
65 * method call, events for the current thread may be processed.
67 * This method MAY NOT be executed from the thread itself. Instead, it is
68 * meant to be executed from another thread (usually the thread that created
69 * this thread or the main application thread). When this function returns,
70 * the thread will be shutdown, and it will no longer be possible to dispatch
71 * events to the thread.
73 * @throws NS_ERROR_UNEXPECTED
74 * Indicates that this method was erroneously called when this thread was
75 * the current thread, that this thread was not created with a call to
76 * nsIThreadManager::NewThread, or if this method was called more than once
77 * on the thread object.
79 void shutdown();
81 /**
82 * This method may be called to determine if there are any events ready to be
83 * processed. It may only be called when this thread is the current thread.
85 * Because events may be added to this thread by another thread, a "false"
86 * result does not mean that this thread has no pending events. It only
87 * means that there were no pending events when this method was called.
89 * @returns
90 * A boolean value that if "true" indicates that this thread has one or
91 * more pending events.
93 * @throws NS_ERROR_UNEXPECTED
94 * Indicates that this method was erroneously called when this thread was
95 * not the current thread.
97 boolean hasPendingEvents();
99 /**
100 * Process the next event. If there are no pending events, then this method
101 * may wait -- depending on the value of the mayWait parameter -- until an
102 * event is dispatched to this thread. This method is re-entrant but may
103 * only be called if this thread is the current thread.
105 * @param mayWait
106 * A boolean parameter that if "true" indicates that the method may block
107 * the calling thread to wait for a pending event.
109 * @returns
110 * A boolean value that if "true" indicates that an event was processed.
112 * @throws NS_ERROR_UNEXPECTED
113 * Indicates that this method was erroneously called when this thread was
114 * not the current thread.
116 boolean processNextEvent(in boolean mayWait);