michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [ptr] native PRThread(PRThread); michael@0: michael@0: interface nsIThread; michael@0: michael@0: /** michael@0: * An interface for creating and locating nsIThread instances. michael@0: */ michael@0: [scriptable, uuid(1be89eca-e2f7-453b-8d38-c11ba247f6f3)] michael@0: interface nsIThreadManager : nsISupports michael@0: { michael@0: /** michael@0: * Default number of bytes reserved for a thread's stack, if no stack size michael@0: * is specified in newThread(). 0 means use platform default. michael@0: */ michael@0: const unsigned long DEFAULT_STACK_SIZE = 0; michael@0: michael@0: /** michael@0: * Create a new thread (a global, user PRThread). michael@0: * michael@0: * @param creationFlags michael@0: * Reserved for future use. Pass 0. michael@0: * @param stackSize michael@0: * Number of bytes to reserve for the thread's stack. michael@0: * michael@0: * @returns michael@0: * The newly created nsIThread object. michael@0: */ michael@0: nsIThread newThread(in unsigned long creationFlags, [optional] in unsigned long stackSize); michael@0: michael@0: /** michael@0: * Get the nsIThread object (if any) corresponding to the given PRThread. michael@0: * This method returns null if there is no corresponding nsIThread. michael@0: * michael@0: * @param prthread michael@0: * The PRThread of the nsIThread being requested. michael@0: * michael@0: * @returns michael@0: * The nsIThread object corresponding to the given PRThread or null if no michael@0: * such nsIThread exists. michael@0: */ michael@0: [noscript] nsIThread getThreadFromPRThread(in PRThread prthread); michael@0: michael@0: /** michael@0: * Get the main thread. michael@0: */ michael@0: readonly attribute nsIThread mainThread; michael@0: michael@0: /** michael@0: * Get the current thread. If the calling thread does not already have a michael@0: * nsIThread associated with it, then a new nsIThread will be created and michael@0: * associated with the current PRThread. michael@0: */ michael@0: readonly attribute nsIThread currentThread; michael@0: michael@0: /** michael@0: * This attribute is true if the calling thread is the main thread of the michael@0: * application process. michael@0: */ michael@0: readonly attribute boolean isMainThread; michael@0: };