git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make fee charging rules inclusive (2 includes 0 and 3 includes fee)
[stg.git]
/
projects
/
rscriptd
/
listener.cpp
diff --git
a/projects/rscriptd/listener.cpp
b/projects/rscriptd/listener.cpp
index 9e03988c2f116cd9e8283b372c49afe3f9a6beb1..730426744e50508556802c06d7bddcb81be91022 100644
(file)
--- a/
projects/rscriptd/listener.cpp
+++ b/
projects/rscriptd/listener.cpp
@@
-102,14
+102,16
@@
running = false;
printfd(__FILE__, "LISTENER::Stop()\n");
printfd(__FILE__, "LISTENER::Stop()\n");
-usleep(500000);
+struct timespec ts = {0, 500000000};
+nanosleep(&ts, NULL);
if (!processorStopped)
{
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !processorStopped; i++)
{
if (!processorStopped)
{
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !processorStopped; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
}
//after 5 seconds waiting thread still running. now killing it
@@
-130,7
+132,8
@@
if (!receiverStopped)
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !receiverStopped; i++)
{
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !receiverStopped; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
}
//after 5 seconds waiting thread still running. now killing it
@@
-162,6
+165,10
@@
return false;
//-----------------------------------------------------------------------------
void * LISTENER::Run(void * d)
{
//-----------------------------------------------------------------------------
void * LISTENER::Run(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
LISTENER * listener = static_cast<LISTENER *>(d);
listener->Runner();
LISTENER * listener = static_cast<LISTENER *>(d);
listener->Runner();
@@
-183,6
+190,10
@@
receiverStopped = true;
//-----------------------------------------------------------------------------
void * LISTENER::RunProcessor(void * d)
{
//-----------------------------------------------------------------------------
void * LISTENER::RunProcessor(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
LISTENER * listener = static_cast<LISTENER *>(d);
listener->ProcessorRunner();
LISTENER * listener = static_cast<LISTENER *>(d);
listener->ProcessorRunner();
@@
-196,7
+207,8
@@
processorStopped = false;
while (running)
{
while (running)
{
- usleep(500000);
+ struct timespec ts = {0, 500000000};
+ nanosleep(&ts, NULL);
if (!pending.empty())
ProcessPending();
ProcessTimeouts();
if (!pending.empty())
ProcessPending();
ProcessTimeouts();