зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1323100 - Create nsThreadPoolNaming::GetNextThreadName. r=froydnj
MozReview-Commit-ID: F0ZFFa5VkAW --HG-- extra : rebase_source : b4ddac4a4d2f668c31beefb5cdfd737b01461c63
This commit is contained in:
Родитель
692210bd80
Коммит
bd9d39ad80
|
@ -440,13 +440,20 @@ NS_GetCurrentThread()
|
|||
#endif
|
||||
|
||||
// nsThreadPoolNaming
|
||||
nsCString
|
||||
nsThreadPoolNaming::GetNextThreadName(const nsACString& aPoolName)
|
||||
{
|
||||
nsCString name(aPoolName);
|
||||
name.AppendLiteral(" #");
|
||||
name.AppendInt(++mCounter, 10); // The counter is declared as atomic
|
||||
return name;
|
||||
}
|
||||
|
||||
void
|
||||
nsThreadPoolNaming::SetThreadPoolName(const nsACString& aPoolName,
|
||||
nsIThread* aThread)
|
||||
{
|
||||
nsCString name(aPoolName);
|
||||
name.AppendLiteral(" #");
|
||||
name.AppendInt(++mCounter, 10); // The counter is declared as volatile
|
||||
nsCString name = GetNextThreadName(aPoolName);
|
||||
|
||||
if (aThread) {
|
||||
// Set on the target thread
|
||||
|
|
|
@ -1037,6 +1037,17 @@ class nsThreadPoolNaming
|
|||
public:
|
||||
nsThreadPoolNaming() : mCounter(0) {}
|
||||
|
||||
/**
|
||||
* Returns a thread name as "<aPoolName> #<n>" and increments the counter.
|
||||
*/
|
||||
nsCString GetNextThreadName(const nsACString& aPoolName);
|
||||
|
||||
template<size_t LEN>
|
||||
nsCString GetNextThreadName(const char (&aPoolName)[LEN])
|
||||
{
|
||||
return GetNextThreadName(nsDependentCString(aPoolName, LEN - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and sets next thread name as "<aPoolName> #<n>"
|
||||
* on the specified thread. If no thread is specified (aThread
|
||||
|
|
Загрузка…
Ссылка в новой задаче