You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: wait.go
    path of file: ./repos/cockroach/pkg/jobs
    
    the code of the file until where you have to start completion: // Copyright 2021 The Cockroach Authors.
//
// Use of this s
    
func (r *Registry) removeFromWaitingSets(id jobspb.JobID) {
	r.mu.Lock()
	defer r.mu.Unlock()
	sets, ok := r.mu.waiting[id]
	if !ok {
		return
	}
	for ws := range sets {

		// Note that the set is only ever mutated underneath this mutex, so it's
		// not possible for any other goroutine to have observed the set become
		// empty.
		delete(ws.set, id)
		if len(ws.set) == 0 {
			close(ws.jobDoneCh)
		}
	}
	delete(r.mu.waiting, id)
}