Commit af098550 authored by Georgios Bitzes's avatar Georgios Bitzes

FST: Small code improvements

parent d5cc6e15
Pipeline #704279 canceled with stages
in 52 seconds
......@@ -69,7 +69,6 @@
// The global OFS handle
eos::fst::XrdFstOfs eos::fst::gOFS;
std::atomic<bool> eos::fst::XrdFstOfs::sShutdown {false};
extern XrdSysError OfsEroute;
extern XrdOss* XrdOfsOss;
......@@ -211,7 +210,7 @@ XrdFstOfs::xrdfstofs_shutdown(int sig)
{
static XrdSysMutex ShutDownMutex;
ShutDownMutex.Lock(); // this handler goes only one-shot .. sorry !
sShutdown = true;
gOFS.sShutdown = true;
pid_t watchdog;
pid_t ppid = getpid();
......@@ -274,7 +273,7 @@ XrdFstOfs::xrdfstofs_graceful_shutdown(int sig)
pid_t watchdog;
static XrdSysMutex grace_shutdown_mtx;
grace_shutdown_mtx.Lock();
sShutdown = true;
gOFS.sShutdown = true;
const char* swait = getenv("EOS_GRACEFUL_SHUTDOWN_TIMEOUT");
std::int64_t wait = (swait ? std::strtol(swait, nullptr, 10) : 390);
pid_t ppid = getpid();
......
......@@ -80,7 +80,7 @@ class XrdFstOfs : public XrdOfs, public eos::common::LogId
friend class RaidMetaLayout;
public:
static std::atomic<bool> sShutdown; ///< True if shutdown procedure is running
std::atomic<bool> sShutdown; ///< True if shutdown procedure is running
//----------------------------------------------------------------------------
//! FST shutdown procedure
......
......@@ -52,12 +52,8 @@ TransferQueue::~TransferQueue() { }
size_t
TransferQueue::GetBandwidth()
{
size_t bw = 0;
{
XrdSysMutexHelper lock(mBandwidthMutex);
bw = bandwidth;
}
return bw;
XrdSysMutexHelper lock(mBandwidthMutex);
return bandwidth;
}
/* ------------------------------------------------------------------------- */
......@@ -72,12 +68,8 @@ TransferQueue::SetBandwidth(size_t band)
size_t
TransferQueue::GetSlots()
{
size_t n = 0;
{
XrdSysMutexHelper lock(mSlotsMutex);
n = nslots;
}
return n;
XrdSysMutexHelper lock(mSlotsMutex);
return nslots;
}
/* ------------------------------------------------------------------------- */
......
......@@ -52,7 +52,6 @@ private:
XrdSysMutex mSlotsMutex;
XrdSysMutex mCallbackMutex;
XrdSysCondVar mJobTerminateCondition;
XrdSysCondVar* mJobEndCallback;
public:
......@@ -99,8 +98,7 @@ public:
XrdSysMutexHelper lock_jobs(mJobsRunningMutex);
mJobsRunning--;
mJobsDone++;
// signal threads waiting for a job to finish
mJobTerminateCondition.Signal();
// signal a call-back condition variable
{
XrdSysMutexHelper lock_cb(mCallbackMutex);
......@@ -114,23 +112,15 @@ public:
size_t
GetRunning()
{
size_t nrun = 0;
{
XrdSysMutexHelper lock(mJobsRunningMutex);
nrun = mJobsRunning;
}
return nrun;
XrdSysMutexHelper lock(mJobsRunningMutex);
return mJobsRunning;
}
unsigned long long
GetDone()
{
size_t ndone = 0;
{
XrdSysMutexHelper lock(mJobsRunningMutex);
ndone = mJobsDone;
}
return ndone;
XrdSysMutexHelper lock(mJobsRunningMutex);
return mJobsDone;
}
size_t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment