VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/threads/nsIThread.idl@ 36233

最後變更 在這個檔案從36233是 1,由 vboxsync 提交於 55 年 前

import

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.8 KB
 
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#include "nsISupports.idl"
39
40%{C++
41#include "prthread.h"
42
43#define NS_THREAD_CID \
44{ /* 85CE5510-7808-11d3-A181-0050041CAF44 */ \
45 0x85ce5510, \
46 0x7808, \
47 0x11d3, \
48 {0xa1, 0x81, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
49}
50
51#define NS_THREAD_CONTRACTID "@mozilla.org/thread;1"
52#define NS_THREAD_CLASSNAME "Thread"
53#if 0
54%}
55
56typedef PRUint32 PRThreadPriority;
57typedef PRUint32 PRThreadScope;
58typedef PRUint32 PRThreadState;
59
60%{C++
61#endif
62%}
63
64interface nsIRunnable;
65
66[ptr] native PRThread(PRThread);
67
68[scriptable, uuid(6be5e380-6886-11d3-9382-00104ba0fd40)]
69interface nsIThread : nsISupports
70{
71 // These must all match the values used in prthread.h
72 const PRUint32 PRIORITY_LOW = 0;
73 const PRUint32 PRIORITY_NORMAL = 1;
74 const PRUint32 PRIORITY_HIGH = 2;
75 const PRUint32 PRIORITY_URGENT = 3;
76
77 const PRUint32 SCOPE_LOCAL = 0;
78 const PRUint32 SCOPE_GLOBAL = 1;
79 const PRUint32 SCOPE_BOUND = 2;
80
81 const PRUint32 STATE_JOINABLE = 0;
82 const PRUint32 STATE_UNJOINABLE = 1;
83
84 void join();
85 void interrupt();
86
87 attribute PRThreadPriority priority;
88 readonly attribute PRThreadScope scope;
89 readonly attribute PRThreadState state;
90
91 [noscript] PRThread GetPRThread();
92
93 void init(in nsIRunnable aRunnable,
94 in PRUint32 aStackSize,
95 in PRThreadPriority aPriority,
96 in PRThreadScope aScope,
97 in PRThreadState aState);
98
99 /*
100 * Get the currently running thread (really a static method sort of thing).
101 */
102 readonly attribute nsIThread currentThread;
103
104 /*
105 * Sleep to at least this many milliseconds (only works on currrent thread).
106 */
107 void sleep(in PRUint32 msec);
108
109%{C++
110 // returns the nsIThread for the current thread:
111 static NS_COM nsresult GetCurrent(nsIThread* *result);
112
113 // returns the nsIThread for an arbitrary PRThread:
114 static NS_COM nsresult GetIThread(PRThread* prthread, nsIThread* *result);
115
116 // initializes the "main" thread (really, just saves the current thread
117 // at time of calling. meant to be called once at app startup, in lieu
118 // of proper static initializers, to save the primordial thread
119 // for later recall.)
120 static NS_COM nsresult SetMainThread();
121
122 // return the "main" thread
123 static NS_COM nsresult GetMainThread(nsIThread **result);
124
125 static NS_COM PRBool IsMainThread();
126%}
127};
128
129%{C++
130extern NS_COM nsresult
131NS_NewThread(nsIThread* *result,
132 nsIRunnable* runnable,
133 PRUint32 stackSize = 0,
134 PRThreadState state = PR_UNJOINABLE_THREAD,
135 PRThreadPriority priority = PR_PRIORITY_NORMAL,
136 PRThreadScope scope = PR_GLOBAL_THREAD);
137
138extern NS_COM nsresult
139NS_NewThread(nsIThread* *result,
140 PRUint32 stackSize = 0,
141 PRThreadState state = PR_UNJOINABLE_THREAD,
142 PRThreadPriority priority = PR_PRIORITY_NORMAL,
143 PRThreadScope scope = PR_GLOBAL_THREAD);
144%}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette