File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -329,14 +329,8 @@ func (workerPoolSelf *DefaultWorkerPool) ScheduleWithTimeout(fn func(), timeout
329329 }
330330
331331 deadline := time .Now ().Add (timeout )
332- workerPoolSelf .lock .Lock ()
333- workerPoolSelf .scheduleWaitCount ++
334- workerPoolSelf .lock .Unlock ()
335- go func () {
336- workerPoolSelf .lock .Lock ()
337- workerPoolSelf .scheduleWaitCount --
338- workerPoolSelf .lock .Unlock ()
339- }()
332+ workerPoolSelf .addScheduleWaitCount (1 )
333+ go workerPoolSelf .addScheduleWaitCount (- 1 )
340334
341335 for {
342336 if workerPoolSelf .IsClosed () {
@@ -358,6 +352,12 @@ func (workerPoolSelf *DefaultWorkerPool) ScheduleWithTimeout(fn func(), timeout
358352 return err
359353}
360354
355+ func (workerPoolSelf * DefaultWorkerPool ) addScheduleWaitCount (amount int ) {
356+ workerPoolSelf .lock .Lock ()
357+ workerPoolSelf .scheduleWaitCount += amount
358+ workerPoolSelf .lock .Unlock ()
359+ }
360+
361361// Invokable
362362
363363// Invokable Invokable inspired by Java ExecutorService
You can’t perform that action at this time.
0 commit comments