title: Preventing concurrency using Combine
body: <p>I have to use a third party SDK to communicate with a Bluetooth device. The SDK only allows one call at a time and a call cannot be cancelled. I have abstracted each call to the SDK with a layer returning Combine publishers.</p>
  <pre><code>struct AbstractedSDKLayer {
    func getBatteryLevel() -&gt; AnyPublisher&lt;Float, Error&gt; { ... }
    func getVersion() -&gt; AnyPublisher&lt;String, Error&gt; { ... }
    ...
  }
  </code></pre>
  <p>My problem occurs when my UI is calling multiple times <code>getBatteryLevel()</code> for instance, because of some actions triggering refresh.</p>
  <p>I have tried to create a custom operator to delay subscription to upstream publisher (because the SDK call is triggered when a subscription is received, using a <code>Deferred { Future }</code>). My idea was to have a &quot;pool&quot; of SDK pending requests, processing one and going on the next one. But well, I think I'm missing some understanding of Combine tools (Subscriber, Subscription, demand...) and my code is not working. I have made some tests using a connectable publisher but with still no success. From my point of view, it seems that most native Combine operator controls the publishing process but not the subscription process.</p>
  <p>My Android colleague has handled this usecase by using a Kotlin coroutine Mutex.</p>
  <p>What is the best way to do this with Combine?</p>