Uploaded image for project: 'Swift'
  1. Swift
  2. SR-1859

DispatchQueue setTarget fails with EXC_BAD_INSTRUCTION

    XMLWordPrintable

    Details

      Description

      With Swift 3, setting the target queue of an existing dispatch queue fails in the Simulator for iOS and tvOS. It does not fail on macOS. (watchOS not tested, and not tested on actual devices).

      This did not fail with Swift 2.2.

      The code below shows the issue:

      func testSetTargetQueue() {
          let queue = DispatchQueue(label: "queue", attributes: DispatchQueueAttributes.serial)
          let syncQueue = DispatchQueue(label: "sync_queue", attributes: DispatchQueueAttributes.serial) 
          queue.setTarget(queue: syncQueue)   // EXC_BAD_INSTRUCTION.  Error: "Cannot change the target of this queue after it has been activated"     
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Andreas Grosam Andreas Grosam
              Reporter:
              Andreas Grosam Andreas Grosam
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: