2014-06-30 19:39:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-09-19 17:54:41 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MainThreadUtils_h_
|
|
|
|
#define MainThreadUtils_h_
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
class nsIThread;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a reference to the main thread.
|
|
|
|
*
|
2014-06-27 05:35:39 +04:00
|
|
|
* @param aResult
|
2013-09-19 17:54:41 +04:00
|
|
|
* The resulting nsIThread object.
|
|
|
|
*/
|
2014-08-28 02:47:27 +04:00
|
|
|
extern NS_METHOD NS_GetMainThread(nsIThread** aResult);
|
2013-09-19 17:54:41 +04:00
|
|
|
|
2014-06-07 01:53:42 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
|
|
|
// Fast access to the current thread. Do not release the returned pointer! If
|
|
|
|
// you want to use this pointer from some other thread, then you will need to
|
|
|
|
// AddRef it. Otherwise, you should only consider this pointer valid from code
|
|
|
|
// running on the current thread.
|
2014-08-28 02:47:27 +04:00
|
|
|
extern nsIThread* NS_GetCurrentThread();
|
2014-06-07 01:53:42 +04:00
|
|
|
#endif
|
|
|
|
|
2014-07-04 14:34:15 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2013-09-19 17:54:41 +04:00
|
|
|
bool NS_IsMainThread();
|
|
|
|
#else
|
|
|
|
/**
|
|
|
|
* Test to see if the current thread is the main thread.
|
|
|
|
*
|
|
|
|
* @returns true if the current thread is the main thread, and false
|
|
|
|
* otherwise.
|
|
|
|
*/
|
2014-08-28 02:47:27 +04:00
|
|
|
extern bool NS_IsMainThread();
|
2013-09-19 17:54:41 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // MainThreadUtils_h_
|