       taskResult = WebTaskResult.Failure(error)
     }
     handlerQueue.suspended = false
+    if let semaphore = semaphore {
+      dispatch_semaphore_signal(semaphore)
+    }
     if let urlTask = urlTask {
       webService?.webDelegate?.tasks.removeValueForKey(urlTask.taskIdentifier)
     }

    }
    
    if let method = WebService.ChallengeMethod(method: authenticationMethod) where method == .Default || method == .HTTPBasic {
      if let maxAuth = webService?.maxAuthRetry where maxAuth == 0 || authCount++ < maxAuth {
        taskResult = authenticationHandler(WebService.ChallengeMethod(method: authenticationMethod)!, completionHandler)
      } else {
        completionHandler(.PerformDefaultHandling, nil)

    urlTask?.resume()
    
    if let semaphore = semaphore {
      let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * Int(NSEC_PER_SEC)))
      dispatch_semaphore_wait(semaphore, time)
      if urlTask?.state == .Running {
        urlTask?.cancel()
