close method

void close()

Undeclares the subscriber and releases native resources.

Safe to call multiple times -- subsequent calls are no-ops.

Implementation

void close() {
  if (_closed) return;
  _closed = true;
  bindings.zd_subscriber_drop(_ptr.cast());
  // closeAndDrain, not a bare port close: a retained handle that arrived and
  // was never delivered has no other owner, so this is its only release.
  _channel.closeAndDrain();
  calloc.free(_ptr);
}