mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
add naming to threads
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
e2fcab34b7
commit
36473e3889
13 changed files with 38 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "Log.h"
|
||||
#include "Timestamp.h"
|
||||
#include "RouterContext.h"
|
||||
|
@ -23,7 +24,7 @@ namespace transport
|
|||
{
|
||||
|
||||
SSUServer::SSUServer (const boost::asio::ip::address & addr, int port):
|
||||
m_OnlyV6(true), m_IsRunning(false), m_Thread (nullptr),
|
||||
m_OnlyV6(true), m_IsRunning(false), m_Thread (nullptr),
|
||||
m_ReceiversThread (nullptr), m_ReceiversThreadV6 (nullptr), m_Work (m_Service),
|
||||
m_ReceiversWork (m_ReceiversService), m_ReceiversWorkV6 (m_ReceiversServiceV6),
|
||||
m_EndpointV6 (addr, port), m_Socket (m_ReceiversService, m_Endpoint),
|
||||
|
@ -36,7 +37,7 @@ namespace transport
|
|||
|
||||
SSUServer::SSUServer (int port):
|
||||
m_OnlyV6(false), m_IsRunning(false), m_Thread (nullptr),
|
||||
m_ReceiversThread (nullptr), m_ReceiversThreadV6 (nullptr), m_Work (m_Service),
|
||||
m_ReceiversThread (nullptr), m_ReceiversThreadV6 (nullptr), m_Work (m_Service),
|
||||
m_ReceiversWork (m_ReceiversService), m_ReceiversWorkV6 (m_ReceiversServiceV6),
|
||||
m_Endpoint (boost::asio::ip::udp::v4 (), port), m_EndpointV6 (boost::asio::ip::udp::v6 (), port),
|
||||
m_Socket (m_ReceiversService), m_SocketV6 (m_ReceiversServiceV6),
|
||||
|
@ -100,7 +101,7 @@ namespace transport
|
|||
if (context.SupportsV6 ())
|
||||
{
|
||||
m_ReceiversThreadV6 = new std::thread (std::bind (&SSUServer::RunReceiversV6, this));
|
||||
if (!m_Thread)
|
||||
if (!m_Thread)
|
||||
m_Thread = new std::thread (std::bind (&SSUServer::Run, this));
|
||||
m_ReceiversServiceV6.post (std::bind (&SSUServer::ReceiveV6, this));
|
||||
ScheduleTerminationV6 ();
|
||||
|
@ -142,6 +143,8 @@ namespace transport
|
|||
|
||||
void SSUServer::Run ()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), "SSU");
|
||||
|
||||
while (m_IsRunning)
|
||||
{
|
||||
try
|
||||
|
@ -157,6 +160,8 @@ namespace transport
|
|||
|
||||
void SSUServer::RunReceivers ()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), "SSUv4");
|
||||
|
||||
while (m_IsRunning)
|
||||
{
|
||||
try
|
||||
|
@ -179,6 +184,8 @@ namespace transport
|
|||
|
||||
void SSUServer::RunReceiversV6 ()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), "SSUv6");
|
||||
|
||||
while (m_IsRunning)
|
||||
{
|
||||
try
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue