如何在Swift中的不同线程中执行函数?

时间:2014-08-14 08:56:10

标签: multithreading swift xcode6

我使用三个函数,我需要在不同的线程中使用,因为当我执行一个函数时,在视图中显示的函数会崩溃..

我正在尝试此代码:

当actions是一个函数时,但是这个崩溃也使用了这个代码

        var concurrentQueue: dispatch_queue_t =
            dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
        dispatch_async(concurrentQueue, {
            self.actions()

            dispatch_async(dispatch_get_main_queue(), {
                println("Completed")
                });
        })

我在做什么?

谢谢!

0 个答案:

没有答案