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: callback_serializer.go
    path of file: ./repos/sliver/vendor/google.golang.org/grpc/internal/grpcsync
    
    the code of the file until where you have to start completion: /*
 *
 * Copyright 2022 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apac
    
func (cs *CallbackSerializer) run(ctx context.Context) {
	var backlog []func(context.Context)

	defer close(cs.done)
	for ctx.Err() == nil {
		select {
		case <-ctx.Done():
			// Do nothing here. Next iteration of the for loop will not happen,
			// since ctx.Err() would be non-nil.
		case callback, ok := <-cs.callbacks.Get():
			if !ok {
				return
			}
			cs.callbacks.Load()
			callback.(func(ctx context.Context))(ctx)
		}
	}

	// Fetch pending callbacks if any, and execute them before returning from
	// this method and closing cs.done.
	cs.closedMu.Lock()
	cs.closed = true
	backlog = cs.fetchPendingCallbacks()
	cs.callbacks.Close()
	cs.closedMu.Unlock()
	for _, b := range backlog {
		b(ctx)
	}
}