 
   override func selectPut(select: ChannelSemaphore, selection: Selection)
   {
-    empty.notify {
-      [weak self] in
-
-      if let this = self
+    empty.notify { [weak self] in
+      guard let this = self else { return }
+
+      if select.setState(.Select)
       {
-        if select.setState(.Select)
-        {
-          select.selection = selection
-          select.signal()
-        }
-        else
-        { // let another writer through
-          this.empty.signal()
-        }
+        select.selection = selection
+        select.signal()
+      }
+      else
+      { // let another writer through
+        this.empty.signal()
       }
     }
   }

  {
    self.capacity = (capacity < 1) ? 1 : min(capacity, 32768)

    filled = SChanSemaphore(value: 0)
    empty =  SChanSemaphore(value: self.capacity)

    // find the next power of 2 that is >= self.capacity


  override func selectGet(select: ChannelSemaphore, selection: Selection)
  {
    filled.notify { [weak self] in
      guard let this = self else { return }

      if select.setState(.Select)
      {
        select.selection = selection
        select.signal()
      }
      else
      { // let another reader through
        this.filled.signal()
      }
    }
  }
