This is an automated email from the ASF dual-hosted git repository.
amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0169ccf TS-4265: Change EventProcessor to use declaration
initialization.
0169ccf is described below
commit 0169ccfb62b964483a4b7419d304bf9740d3454b
Author: Alan M. Carroll <[email protected]>
AuthorDate: Thu Jun 1 15:01:14 2017 -0500
TS-4265: Change EventProcessor to use declaration initialization.
---
iocore/eventsystem/I_EventProcessor.h | 15 ++++++---------
iocore/eventsystem/P_UnixEventProcessor.h | 10 +++++-----
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/iocore/eventsystem/I_EventProcessor.h
b/iocore/eventsystem/I_EventProcessor.h
index f86d335..e4554db 100644
--- a/iocore/eventsystem/I_EventProcessor.h
+++ b/iocore/eventsystem/I_EventProcessor.h
@@ -229,6 +229,8 @@ public:
Event *reschedule_every(Event *e, ink_hrtime aperiod, int callback_event =
EVENT_INTERVAL);
EventProcessor();
+ EventProcessor(const EventProcessor &) = delete;
+ EventProcessor &operator=(const EventProcessor &) = delete;
/**
Initializes the EventProcessor and its associated threads. Spawns the
@@ -284,19 +286,14 @@ public:
those created by spawn_thread
*/
- int n_ethreads;
+ int n_ethreads = 0;
/**
Total number of thread groups created so far. This is the count of
all the thread groups (event types) created for this EventProcessor.
*/
- int n_thread_groups;
-
-private:
- // prevent unauthorized copies (Not implemented)
- EventProcessor(const EventProcessor &);
- EventProcessor &operator=(const EventProcessor &);
+ int n_thread_groups = 0;
public:
/*------------------------------------------------------*\
@@ -307,8 +304,8 @@ public:
EThread *assign_thread(EventType etype);
EThread *all_dthreads[MAX_EVENT_THREADS];
- volatile int n_dthreads; // No. of dedicated threads
- volatile int thread_data_used;
+ volatile int n_dthreads = 0; // No. of dedicated threads
+ volatile int thread_data_used = 0;
ink_mutex dedicated_spawn_thread_mutex;
};
diff --git a/iocore/eventsystem/P_UnixEventProcessor.h
b/iocore/eventsystem/P_UnixEventProcessor.h
index b35938e..b3ee7d9 100644
--- a/iocore/eventsystem/P_UnixEventProcessor.h
+++ b/iocore/eventsystem/P_UnixEventProcessor.h
@@ -30,12 +30,12 @@
const int LOAD_BALANCE_INTERVAL = 1;
TS_INLINE
-EventProcessor::EventProcessor() : n_ethreads(0), n_thread_groups(0),
n_dthreads(0), thread_data_used(0)
+EventProcessor::EventProcessor()
{
- memset(all_ethreads, 0, sizeof(all_ethreads));
- memset(all_dthreads, 0, sizeof(all_dthreads));
- memset(n_threads_for_type, 0, sizeof(n_threads_for_type));
- memset(next_thread_for_type, 0, sizeof(next_thread_for_type));
+ ink_zero(all_ethreads);
+ ink_zero(all_dthreads);
+ ink_zero(n_threads_for_type);
+ ink_zero(next_thread_for_type);
ink_mutex_init(&dedicated_spawn_thread_mutex);
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].