code: func go_on_disconnect_callback(privateCtx unsafe.Pointer) C.int {
  	log.Debug("go_on_disconnect_callback BEGIN")
  	defer log.Debug("go_on_disconnect_callback END")
  	context.lock.RLock()
  	defer context.lock.RUnlock()
  
  	// Get memif reference.
  	ifIndex := int(uintptr(privateCtx))
  	memif, exists := context.memifs[ifIndex]
  	if !exists {
  		// Already closed.
  		return C.int(0)
  	}
  
  	// Stop polling the RX queues for interrupts.
  	buf := make([]byte, 8)
  	binary.PutUvarint(buf, 1)
  	// - add an event
  	_, err := syscall.Write(memif.stopQPollFd, buf[:])
  	if err != nil {
  		return C.int(ErrSyscall.Code())
  	}
  	// - wait
  	memif.wg.Wait()
  	// - remove the event
  	_, err = syscall.Read(memif.stopQPollFd, buf[:])
  	if err != nil {
  		return C.int(ErrSyscall.Code())
  	}
  
  	// Call the user callback.
  	if memif.callbacks.OnDisconnect != nil {
  		memif.callbacks.OnDisconnect(memif)
  	}
  
  	// Close Rx/Tx queues.
  	memif.closeQueues()
  
  	return C.int(0)
  }
docs: //export go_on_disconnect_callback