riteshghorse commented on code in PR #17432:
URL: https://github.com/apache/beam/pull/17432#discussion_r863896226
##########
sdks/go/pkg/beam/core/sdf/lock.go:
##########
@@ -80,3 +80,73 @@ func (rt *LockRTracker) GetRestriction() interface{} {
defer rt.Mu.Unlock()
return rt.Rt.GetRestriction()
}
+
+// NewLockBoundableRTracker creates a LockBoundableRTracker initialized with
the specified
+// restriction tracker as its underlying restriction tracker.
+func NewLockBoundableRTracker(rt BoundableRTracker) *LockRTracker {
+ return &LockRTracker{Rt: rt}
+}
+
+// LockBoundableRTracker is a restriction tracker that wraps another
restriction
+// tracker and adds thread safety to it by locking a mutex in each method,
+// before delegating to the underlying tracker.
+type LockBoundableRTracker struct {
Review Comment:
Makes sense. I should have made the changes here as well when doing it for
`defaultTruncateRestriction`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]