// Add adds a new handler to signal. func (l *SignalReactor) Add(fn interface{}) func() { l.lock.Lock() defer l.lock.Unlock() id := timer.GetMonotonicTime().NanoSeconds() l.elements.PushBack(newReactorElement(id, fn)) return l.newDetacher(id) }
func (job *CopyMoveJob) reportCopyProgress() { now := timer.GetMonotonicTime().MicroSeconds() if job.lastReportTime != 0 && math.Abs(float64(int64(job.lastReportTime)-now)) < 100*_NsecPerMicrosec { return } job.lastReportTime = uint64(now) job.emitProcessedAmount(job.processedAmount[AmountUnitBytes], AmountUnitBytes) job.emitProcessedAmount(job.processedAmount[AmountUnitFiles], AmountUnitFiles) job.emitProcessedAmount(job.processedAmount[AmountUnitDirectories], AmountUnitDirectories) }