#include "prthread.h"#include "prinrval.h"#include "nsIThreadManager.h"#include "nsIThread.h"#include "nsIRunnable.h"#include "nsStringGlue.h"#include "nsCOMPtr.h"#include "nsAutoPtr.h"#include "mozilla/threads/nsThreadIDs.h"
Include dependency graph for nsThreadUtils.h:
This graph shows which files directly or indirectly include this file:Classes | |
| class | nsRunnable |
| class | nsRunnableMethod< ClassType, ReturnType, Owning > |
| class | nsRunnableMethod< ClassType, ReturnType, Owning >::ReturnTypeEnforcer< OtherReturnType > |
| class | nsRunnableMethod< ClassType, ReturnType, Owning >::ReturnTypeEnforcer< already_AddRefed< T > > |
| struct | nsRunnableMethodReceiver< ClassType, Owning > |
| struct | nsRunnableMethodReceiver< ClassType, false > |
| struct | nsRunnableMethodTraits< R(C::*)(), Owning > |
| class | nsRunnableMethodImpl< Method, Owning > |
| class | nsRevocableEventPtr< T > |
Defines | |
| #define | IMETHOD_VISIBILITY NS_COM_GLUE |
| #define | IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN |
Functions | |
| nsresult | NS_NewThread (nsIThread **result, nsIRunnable *initialEvent=0L) |
| Create a new thread, and optionally provide an initial event for the thread. | |
| nsresult | NS_GetCurrentThread (nsIThread **result) |
| Get a reference to the current thread. | |
| nsresult | NS_GetMainThread (nsIThread **result) |
| Get a reference to the main thread. | |
| bool | NS_IsMainThread () |
| Test to see if the current thread is the main thread. | |
| nsresult | NS_DispatchToCurrentThread (nsIRunnable *event) |
| Dispatch the given event to the current thread. | |
| nsresult | NS_DispatchToMainThread (nsIRunnable *event, PRUint32 dispatchFlags=NS_DISPATCH_NORMAL) |
| Dispatch the given event to the main thread. | |
| nsresult | NS_ProcessPendingEvents (nsIThread *thread, PRIntervalTime timeout=0xffffffffUL) |
| Process all pending events for the given thread before returning. | |
| PRBool | NS_HasPendingEvents (nsIThread *thread=0L) |
| Shortcut for nsIThread::HasPendingEvents. | |
| PRBool | NS_ProcessNextEvent (nsIThread *thread=0L, PRBool mayWait=1) |
| Shortcut for nsIThread::ProcessNextEvent. | |
| already_AddRefed< nsIThread > | do_GetCurrentThread () |
| already_AddRefed< nsIThread > | do_GetMainThread () |
| template<typename PtrType , typename Method > | |
| nsRunnableMethodTraits< Method, true >::base_type * | NS_NewRunnableMethod (PtrType ptr, Method method) |
| template<typename PtrType , typename Method > | |
| nsRunnableMethodTraits< Method, false >::base_type * | NS_NewNonOwningRunnableMethod (PtrType ptr, Method method) |
| #define IMETHOD_VISIBILITY NS_COM_GLUE |
| #define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN |
| already_AddRefed<nsIThread> do_GetCurrentThread | ( | ) | [inline] |
| already_AddRefed<nsIThread> do_GetMainThread | ( | ) | [inline] |
| nsresult NS_DispatchToCurrentThread | ( | nsIRunnable * | event | ) |
Dispatch the given event to the current thread.
| event | The event to dispatch. |
| nsresult NS_DispatchToMainThread | ( | nsIRunnable * | event, | |
| PRUint32 | dispatchFlags = NS_DISPATCH_NORMAL | |||
| ) |
Dispatch the given event to the main thread.
| event | The event to dispatch. | |
| dispatchFlags | The flags to pass to the main thread's dispatch method. |
Get a reference to the current thread.
| result | The resulting nsIThread object. |
Get a reference to the main thread.
| result | The resulting nsIThread object. |
Shortcut for nsIThread::HasPendingEvents.
It is an error to call this function when the given thread is not the current thread. This function will return PR_FALSE if called from some other thread.
| thread | The current thread or null. |
| bool NS_IsMainThread | ( | ) |
Test to see if the current thread is the main thread.
| nsRunnableMethodTraits<Method, false>::base_type* NS_NewNonOwningRunnableMethod | ( | PtrType | ptr, | |
| Method | method | |||
| ) |
| nsRunnableMethodTraits<Method, true>::base_type* NS_NewRunnableMethod | ( | PtrType | ptr, | |
| Method | method | |||
| ) |
| nsresult NS_NewThread | ( | nsIThread ** | result, | |
| nsIRunnable * | initialEvent = 0L | |||
| ) |
Create a new thread, and optionally provide an initial event for the thread.
| result | The resulting nsIThread object. | |
| initialEvent | The initial event to run on this thread. This parameter may be null. |
Shortcut for nsIThread::ProcessNextEvent.
It is an error to call this function when the given thread is not the current thread. This function will simply return PR_FALSE if called from some other thread.
| thread | The current thread or null. | |
| mayWait | A boolean parameter that if "true" indicates that the method may block the calling thread to wait for a pending event. |
| nsresult NS_ProcessPendingEvents | ( | nsIThread * | thread, | |
| PRIntervalTime | timeout = 0xffffffffUL | |||
| ) |
Process all pending events for the given thread before returning.
This method simply calls ProcessNextEvent on the thread while HasPendingEvents continues to return true and the time spent in NS_ProcessPendingEvents does not exceed the given timeout value.
| thread | The thread object for which to process pending events. If null, then events will be processed for the current thread. | |
| timeout | The maximum number of milliseconds to spend processing pending events. Events are not pre-empted to honor this timeout. Rather, the timeout value is simply used to determine whether or not to process another event. Pass PR_INTERVAL_NO_TIMEOUT to specify no timeout. |
1.7.1