File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,14 @@ Scheduler::Scheduler()
72
72
}
73
73
74
74
Scheduler::~Scheduler () {
75
+ CancelAllAndShutdownWorkerThread ();
76
+ }
77
+
78
+ void Scheduler::CancelAllAndShutdownWorkerThread () {
75
79
{
76
- // Notify the worker thread to stop processing anymore request
80
+ // Notify the worker thread to stop processing anymore requests.
77
81
MutexLock lock (request_mutex_);
82
+ if (terminating_) return ;
78
83
terminating_ = true ;
79
84
}
80
85
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ class Scheduler {
123
123
ScheduleTimeMs delay = 0, ScheduleTimeMs repeat = 0);
124
124
#endif // FIREBASE_USE_STD_FUNCTION
125
125
126
+ // Cancel all scheduled callbacks and shut down the worker thread.
127
+ void CancelAllAndShutdownWorkerThread ();
128
+
126
129
private:
127
130
typedef uint64_t RequestId;
128
131
// The request data for all scheduled callback.
You can’t perform that action at this time.
0 commit comments