File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -932,7 +932,13 @@ func newWakeableSleep() *wakeableSleep {
932
932
func (s * wakeableSleep ) sleep (ns int64 ) {
933
933
resetTimer (s .timer , nanotime ()+ ns )
934
934
lock (& s .lock )
935
+ if raceenabled {
936
+ raceacquire (unsafe .Pointer (& s .lock ))
937
+ }
935
938
wakeup := s .wakeup
939
+ if raceenabled {
940
+ racerelease (unsafe .Pointer (& s .lock ))
941
+ }
936
942
unlock (& s .lock )
937
943
<- wakeup
938
944
stopTimer (s .timer )
@@ -945,6 +951,9 @@ func (s *wakeableSleep) wake() {
945
951
// Grab the wakeup channel, which may be nil if we're
946
952
// racing with close.
947
953
lock (& s .lock )
954
+ if raceenabled {
955
+ raceacquire (unsafe .Pointer (& s .lock ))
956
+ }
948
957
if s .wakeup != nil {
949
958
// Non-blocking send.
950
959
//
@@ -956,6 +965,9 @@ func (s *wakeableSleep) wake() {
956
965
default :
957
966
}
958
967
}
968
+ if raceenabled {
969
+ racerelease (unsafe .Pointer (& s .lock ))
970
+ }
959
971
unlock (& s .lock )
960
972
}
961
973
@@ -969,11 +981,18 @@ func (s *wakeableSleep) wake() {
969
981
func (s * wakeableSleep ) close () {
970
982
// Set wakeup to nil so that a late timer ends up being a no-op.
971
983
lock (& s .lock )
984
+ if raceenabled {
985
+ raceacquire (unsafe .Pointer (& s .lock ))
986
+ }
972
987
wakeup := s .wakeup
973
988
s .wakeup = nil
974
989
975
990
// Close the channel.
976
991
close (wakeup )
992
+
993
+ if raceenabled {
994
+ racerelease (unsafe .Pointer (& s .lock ))
995
+ }
977
996
unlock (& s .lock )
978
997
return
979
998
}
You can’t perform that action at this time.
0 commit comments