swift调用C

swift中如何调用C代码呢? swift通过工程的桥接文件,调用OC或C相关代码!!! 1.C文件 test.h和test.c test.h 1 2 3 4 5 6 7 8

go变量声明和使用

go变量声明和使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 package main import "fmt" var x, y int var ( a int b bool ) var c, d int = 1, 2 var

swift中pthread_t之mutex

mutex类型有四种 PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_DEFAULT 1.mutex初始化 1 2 3 4 5 6 var mutex = pthread_mutex_t() var attr: pthread_mutexattr_t = pthread_mutexattr_t() pthread_mutexattr_init(&attr) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) pthread_mutex_init(&mutex, &attr) 2.mutex使用 1 2 3 pthread_mutex_trylock(&mutex) //执行代码块 pthread_mutex_unlock(&mutex) 3.mut

synchronized到objc_sync_enter/objc_sync_exit

synchronized->objc_sync_enter/objc_sync_exit objc_sync_enter: 递归锁,与objc_sync_exit配合使用,注意死锁 Begin synchronizing on ‘obj’. Allocates recursive pthread_mutex associated with ‘obj’ if needed. Parameters obj The object to begin synchronizing on. Returns OBJC_SYNC_SUCCESS once lock is

直播协议对比

直播协议 优势 劣势 RTP /RTCP RTP 实行有序传送,RTP中的序列号允许接收方重组发送方的包序列,同时序列号也能用于决定适当的包位置,如在视频解码中,就不需

swift-ecdh

swift 在iOS10之后,支持ecdh加解密。 1.生成公钥和私钥 1 2 3 4 5 6 7 8 9 10 11 12 13 func generateKey() { let attributes: [String: Any] = [kSecAttrKeySizeInBits as String: 256, kSecAttrKeyType as String: kSecAttrKeyTypeEC, kSecPrivateKeyAttrs as String: [kSecAttrIsPermanent as String: false]] var error: Unmanaged<CFError>? self.privateKey =