mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Reformatting using AStyle
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
|
||||
void setCallingThreadName (char const* threadName)
|
||||
{
|
||||
struct ThreadInfo
|
||||
{
|
||||
DWORD dwType;
|
||||
LPCSTR szName;
|
||||
DWORD dwThreadID;
|
||||
DWORD dwFlags;
|
||||
};
|
||||
struct ThreadInfo
|
||||
{
|
||||
DWORD dwType;
|
||||
LPCSTR szName;
|
||||
DWORD dwThreadID;
|
||||
DWORD dwFlags;
|
||||
};
|
||||
|
||||
ThreadInfo info;
|
||||
ThreadInfo info;
|
||||
|
||||
info.dwType = 0x1000;
|
||||
info.szName = threadName;
|
||||
@@ -38,45 +38,52 @@ void setCallingThreadName (char const* threadName)
|
||||
|
||||
__try
|
||||
{
|
||||
// This is a VisualStudio specific exception
|
||||
// This is a VisualStudio specific exception
|
||||
RaiseException (0x406d1388, 0, sizeof (info) / sizeof (ULONG_PTR), (ULONG_PTR*) &info);
|
||||
}
|
||||
__except (EXCEPTION_CONTINUE_EXECUTION)
|
||||
{
|
||||
}
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef PR_SET_NAME
|
||||
#define HAVE_NAME_THREAD
|
||||
extern void setCallingThreadName (const char* n)
|
||||
{
|
||||
static std::string pName;
|
||||
#ifdef PR_SET_NAME
|
||||
#define HAVE_NAME_THREAD
|
||||
extern void setCallingThreadName (const char* n)
|
||||
{
|
||||
static std::string pName;
|
||||
|
||||
if (pName.empty())
|
||||
{
|
||||
std::ifstream cLine("/proc/self/cmdline", std::ios::in);
|
||||
cLine >> pName;
|
||||
if (pName.empty())
|
||||
pName = "rippled";
|
||||
else
|
||||
{
|
||||
size_t zero = pName.find_first_of('\0');
|
||||
if ((zero != std::string::npos) && (zero != 0))
|
||||
pName = pName.substr(0, zero);
|
||||
size_t slash = pName.find_last_of('/');
|
||||
if (slash != std::string::npos)
|
||||
pName = pName.substr(slash + 1);
|
||||
}
|
||||
pName += " ";
|
||||
}
|
||||
if (pName.empty ())
|
||||
{
|
||||
std::ifstream cLine ("/proc/self/cmdline", std::ios::in);
|
||||
cLine >> pName;
|
||||
|
||||
prctl(PR_SET_NAME, (pName + n).c_str(), 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
if (pName.empty ())
|
||||
pName = "rippled";
|
||||
else
|
||||
{
|
||||
size_t zero = pName.find_first_of ('\0');
|
||||
|
||||
#ifndef HAVE_NAME_THREAD
|
||||
extern void setCallingThreadName(const char*)
|
||||
{ ; }
|
||||
#endif
|
||||
if ((zero != std::string::npos) && (zero != 0))
|
||||
pName = pName.substr (0, zero);
|
||||
|
||||
size_t slash = pName.find_last_of ('/');
|
||||
|
||||
if (slash != std::string::npos)
|
||||
pName = pName.substr (slash + 1);
|
||||
}
|
||||
|
||||
pName += " ";
|
||||
}
|
||||
|
||||
prctl (PR_SET_NAME, (pName + n).c_str (), 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NAME_THREAD
|
||||
extern void setCallingThreadName (const char*)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user