您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package util
  4. import (
  5. "time"
  6. )
  7. // StopTimer is a utility function to safely stop a time.Timer and clean its channel
  8. func StopTimer(t *time.Timer) bool {
  9. stopped := t.Stop()
  10. if !stopped {
  11. select {
  12. case <-t.C:
  13. default:
  14. }
  15. }
  16. return stopped
  17. }