hirohitokato on master
Update README.md (compare)
hirohitokato on master
Update README.md (compare)
hirohitokato on 0.6.0
hirohitokato on v0.6.1
hirohitokato on 0.8.0
hirohitokato on master
Bump the version, update README… (compare)
hirohitokato on swift4
hirohitokato on master
Update build setting to swift4 protocol `Printable,DebugPrinta… `CMSampleBufferRef` to `CMSampl… and 29 more (compare)
hirohitokato on swift4
Resolve fatal error(1): Add pri… Reconnect IBActions Update copyright year and 1 more (compare)
hirohitokato on swift4
Update build setting to swift4 protocol `Printable,DebugPrinta… `CMSampleBufferRef` to `CMSampl… and 24 more (compare)
import Foundation
import QuartzCore
func benchmark(block: () -> ()) -> String {
let measure = {(begin: CFTimeInterval) -> CFTimeInterval in block(); return CACurrentMediaTime() - begin}
let result = String(format: "Total Runtime: %g sec", measure(CACurrentMediaTime()))
println(result)
return result
}
// MARK: -
benchmark {
// write code here
}
こんなのが入ったPlaygroundをサクッと新規作成できるようにした。
objc_sync_enter()
の実装を見てみるといいよ。/Users/norio/Documents/workspace/github/SimpleGaplessPlayer/HKLAVGaplessPlayer/HKLAVGaplessPlayer/StreamFrameProducer.swift:413:5: warning: declaring a public instance method for an internal class
public func getPositionOf(position:Float) -> (index:Int, time:CMTime)? {
^~~~~~
internal
/Users/norio/Documents/workspace/github/SimpleGaplessPlayer/HKLAVGaplessPlayer/HKLAVGaplessPlayer/StreamFrameProducer.swift:412:1: error: extension of internal class cannot be declared public
public extension StreamFrameProducer {
^~~~~~
dispatch_queue_t
には「特定のスレッドで実行する」っていう属性があって、それらにたいしてdispatch_sync()
した場合は、ちゃんとそのスレッドで実行されます。
なので
dispatch_sync(dispatch_get_main_queue()){
// メインスレッドで実行したい!
}
はメインスレッドで実行されます。