mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
cleaning up initializePointee/deinitializePointee, error messages and comments
This commit is contained in:
@@ -15,7 +15,7 @@ func _stdlib_getPointer(x: OpaquePointer) -> OpaquePointer
|
||||
|
||||
public func _opaqueIdentity<T>(x: T) -> T {
|
||||
let ptr = UnsafeMutablePointer<T>(allocatingCapacity: 1)
|
||||
ptr.initializeMemory(x)
|
||||
ptr.initializePointee(x)
|
||||
let result =
|
||||
UnsafeMutablePointer<T>(_stdlib_getPointer(OpaquePointer(ptr))).pointee
|
||||
ptr.deinitializePointee()
|
||||
|
||||
@@ -35,7 +35,7 @@ public struct _stdlib_ShardedAtomicCounter {
|
||||
let count = max(8, hardwareConcurrency * hardwareConcurrency)
|
||||
let shards = UnsafeMutablePointer<Int>(allocatingCapacity: count)
|
||||
for var i = 0; i != count; i++ {
|
||||
(shards + i).initializeMemory(0)
|
||||
(shards + i).initializePointee(0)
|
||||
}
|
||||
self._shardsPtr = shards
|
||||
self._shardsCount = count
|
||||
|
||||
@@ -42,7 +42,7 @@ internal class PthreadBlockContextImpl<Argument, Result>: PthreadBlockContext {
|
||||
|
||||
override func run() -> UnsafeMutablePointer<Void> {
|
||||
let result = UnsafeMutablePointer<Result>(allocatingCapacity: 1)
|
||||
result.initializeMemory(block(arg))
|
||||
result.initializePointee(block(arg))
|
||||
return UnsafeMutablePointer(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public func _stdlib_bridgeNSErrorToErrorProtocol<
|
||||
T : _ObjectiveCBridgeableErrorProtocol
|
||||
>(error: NSError, out: UnsafeMutablePointer<T>) -> Bool {
|
||||
if let bridged = T(_bridgedNSError: error) {
|
||||
out.initializeMemory(bridged)
|
||||
out.initializePointee(bridged)
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
@@ -224,7 +224,7 @@ extension _ArrayBuffer {
|
||||
// Make another pass to retain the copied objects
|
||||
var result = target
|
||||
for _ in bounds {
|
||||
result.initializeMemory(result.pointee)
|
||||
result.initializePointee(result.pointee)
|
||||
result += 1
|
||||
}
|
||||
return result
|
||||
|
||||
@@ -167,7 +167,7 @@ extension _ArrayBufferProtocol {
|
||||
}
|
||||
// Initialize the hole left by sliding the tail forward
|
||||
for j in oldTailIndex..<newTailIndex {
|
||||
(elements + j).initializeMemory(newValues[i])
|
||||
(elements + j).initializePointee(newValues[i])
|
||||
i._successorInPlace()
|
||||
}
|
||||
_expectEnd(i, newValues)
|
||||
|
||||
@@ -83,7 +83,7 @@ public func _arrayForceCast<SourceElement, TargetElement>(
|
||||
_require(
|
||||
bridged != nil, "array element cannot be bridged to Objective-C")
|
||||
// FIXME: should be an unsafeDowncast.
|
||||
p.initializeMemory(unsafeBitCast(bridged!, TargetElement.self))
|
||||
p.initializePointee(unsafeBitCast(bridged!, TargetElement.self))
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ ElementwiseBridging:
|
||||
if _slowPath(value == nil) {
|
||||
break ElementwiseBridging
|
||||
}
|
||||
p.initializeMemory(value!)
|
||||
p.initializePointee(value!)
|
||||
p += 1
|
||||
}
|
||||
return Array(_ArrayBuffer(buf, shiftedToStartIndex: 0))
|
||||
|
||||
@@ -511,7 +511,7 @@ extension ${Self} : _ArrayProtocol {
|
||||
var p: UnsafeMutablePointer<Element>
|
||||
(self, p) = ${Self}._allocateUninitialized(length)
|
||||
for _ in 0..<length {
|
||||
p.initializeMemory(repeatedValue)
|
||||
p.initializePointee(repeatedValue)
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
@@ -670,7 +670,7 @@ extension ${Self} : _ArrayProtocol {
|
||||
_sanityCheck(_buffer.capacity >= _buffer.length + 1)
|
||||
|
||||
_buffer.length = oldLength + 1
|
||||
(_buffer.firstElementAddress + oldLength).initializeMemory(newElement)
|
||||
(_buffer.firstElementAddress + oldLength).initializePointee(newElement)
|
||||
}
|
||||
|
||||
/// Append `newElement` to the ${Self}.
|
||||
@@ -899,7 +899,7 @@ internal struct _InitializeMemoryFromCollection<
|
||||
var p = rawMemory
|
||||
var q = newValues.startIndex
|
||||
for _ in 0..<length {
|
||||
p.initializeMemory(newValues[q])
|
||||
p.initializePointee(newValues[q])
|
||||
q = q.successor()
|
||||
p += 1
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ internal struct _InitializePointer<T> : _PointerFunction {
|
||||
internal func call(rawMemory: UnsafeMutablePointer<T>, length: Int) {
|
||||
_sanityCheck(length == 1)
|
||||
// FIXME: it would be better if we could find a way to move, here
|
||||
rawMemory.initializeMemory(newValue)
|
||||
rawMemory.initializePointee(newValue)
|
||||
}
|
||||
|
||||
@_transparent
|
||||
@@ -1236,7 +1236,7 @@ internal func _arrayAppendSequence<
|
||||
let base = buffer.firstElementAddress
|
||||
|
||||
while (nextItem != nil) && length < capacity {
|
||||
(base + length++).initializeMemory(nextItem!)
|
||||
(base + length++).initializePointee(nextItem!)
|
||||
nextItem = stream.next()
|
||||
}
|
||||
buffer.length = length
|
||||
|
||||
@@ -591,7 +591,7 @@ extension Sequence
|
||||
} else {
|
||||
var p = ptr
|
||||
for x in self {
|
||||
p.initializeMemory(x)
|
||||
p.initializePointee(x)
|
||||
p += 1
|
||||
}
|
||||
return p
|
||||
|
||||
@@ -147,7 +147,7 @@ final class _ContiguousArrayStorage<Element> : _ContiguousArrayStorage1 {
|
||||
let resultPtr = result.baseAddress
|
||||
let p = __manager._elementPointer
|
||||
for i in 0..<length {
|
||||
(resultPtr + i).initializeMemory(_bridgeToObjectiveCUnconditional(p[i]))
|
||||
(resultPtr + i).initializePointee(_bridgeToObjectiveCUnconditional(p[i]))
|
||||
}
|
||||
_fixLifetime(__manager)
|
||||
return result
|
||||
@@ -612,7 +612,7 @@ internal func _copyCollectionToNativeArrayBuffer<
|
||||
var i = source.startIndex
|
||||
for _ in 0..<length {
|
||||
// FIXME(performance): use _initializeTo().
|
||||
p.initializeMemory(source[i])
|
||||
p.initializePointee(source[i])
|
||||
i._successorInPlace()
|
||||
p._successorInPlace()
|
||||
}
|
||||
@@ -671,7 +671,7 @@ internal struct _UnsafePartiallyInitializedContiguousArrayBuffer<Element> {
|
||||
"_UnsafePartiallyInitializedContiguousArrayBuffer has no more capacity")
|
||||
remainingCapacity -= 1
|
||||
|
||||
p.initializeMemory(element)
|
||||
p.initializePointee(element)
|
||||
p += 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1643,7 +1643,7 @@ internal struct _BitMap {
|
||||
|
||||
internal func initializeToZero() {
|
||||
for i in 0 ..< numberOfWords {
|
||||
(values + i).initializeMemory(0)
|
||||
(values + i).initializePointee(0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1982,7 +1982,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
|
||||
internal func initializeKey(k: Key, at i: Int) {
|
||||
_sanityCheck(!isInitializedEntry(i))
|
||||
|
||||
(keys + i).initializeMemory(k)
|
||||
(keys + i).initializePointee(k)
|
||||
initializedEntries[i] = true
|
||||
_fixLifetime(self)
|
||||
}
|
||||
@@ -1990,7 +1990,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
|
||||
@_transparent
|
||||
internal func moveInitializeFrom(from: Storage, at: Int, toEntryAt: Int) {
|
||||
_sanityCheck(!isInitializedEntry(toEntryAt))
|
||||
(keys + toEntryAt).initializeMemory((from.keys + at).take())
|
||||
(keys + toEntryAt).initializePointee((from.keys + at).take())
|
||||
from.initializedEntries[at] = false
|
||||
initializedEntries[toEntryAt] = true
|
||||
}
|
||||
@@ -2008,8 +2008,8 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
|
||||
internal func initializeKey(k: Key, value v: Value, at i: Int) {
|
||||
_sanityCheck(!isInitializedEntry(i))
|
||||
|
||||
(keys + i).initializeMemory(k)
|
||||
(values + i).initializeMemory(v)
|
||||
(keys + i).initializePointee(k)
|
||||
(values + i).initializePointee(v)
|
||||
initializedEntries[i] = true
|
||||
_fixLifetime(self)
|
||||
}
|
||||
@@ -2017,8 +2017,8 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
|
||||
@_transparent
|
||||
internal func moveInitializeFrom(from: Storage, at: Int, toEntryAt: Int) {
|
||||
_sanityCheck(!isInitializedEntry(toEntryAt))
|
||||
(keys + toEntryAt).initializeMemory((from.keys + at).take())
|
||||
(values + toEntryAt).initializeMemory((from.values + at).take())
|
||||
(keys + toEntryAt).initializePointee((from.keys + at).take())
|
||||
(values + toEntryAt).initializePointee((from.values + at).take())
|
||||
from.initializedEntries[at] = false
|
||||
initializedEntries[toEntryAt] = true
|
||||
}
|
||||
@@ -2331,7 +2331,7 @@ internal struct _BridgedNative${Self}Storage {
|
||||
internal func initializeKey(k: AnyObject, at i: Int) {
|
||||
_sanityCheck(!isInitializedEntry(i))
|
||||
|
||||
(keys + i).initializeMemory(k)
|
||||
(keys + i).initializePointee(k)
|
||||
initializedEntries[i] = true
|
||||
_fixLifetime(self)
|
||||
}
|
||||
@@ -2341,8 +2341,8 @@ internal struct _BridgedNative${Self}Storage {
|
||||
) {
|
||||
_sanityCheck(!isInitializedEntry(i))
|
||||
|
||||
(keys + i).initializeMemory(k)
|
||||
(values + i).initializeMemory(v)
|
||||
(keys + i).initializePointee(k)
|
||||
(values + i).initializePointee(v)
|
||||
initializedEntries[i] = true
|
||||
_fixLifetime(self)
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ struct _HeapBuffer<Value, Element> : Equatable {
|
||||
let object: AnyObject = _swift_bufferAllocate(
|
||||
storageClass, totalSize, alignMask)
|
||||
self._storage = Builtin.castToNativeObject(object)
|
||||
self._value.initializeMemory(initializer)
|
||||
self._value.initializePointee(initializer)
|
||||
}
|
||||
|
||||
public // @testable
|
||||
|
||||
@@ -187,7 +187,7 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
|
||||
|
||||
// initialize the value field
|
||||
withUnsafeMutablePointerToValue {
|
||||
$0.initializeMemory(
|
||||
$0.initializePointee(
|
||||
initialValue(
|
||||
buffer: self.buffer,
|
||||
capacity: {
|
||||
|
||||
@@ -138,7 +138,7 @@ public protocol _Mirror {
|
||||
@_silgen_name("swift_getSummary")
|
||||
public // COMPILER_INTRINSIC
|
||||
func _getSummary<T>(out: UnsafeMutablePointer<String>, x: T) {
|
||||
out.initializeMemory(_reflect(x).summary)
|
||||
out.initializePointee(_reflect(x).summary)
|
||||
}
|
||||
|
||||
/// Produce a mirror for any value. If the value's type conforms to
|
||||
|
||||
@@ -609,7 +609,7 @@ extension Sequence {
|
||||
-> UnsafeMutablePointer<Iterator.Element> {
|
||||
var p = UnsafeMutablePointer<Iterator.Element>(ptr)
|
||||
for x in IteratorSequence(self.iterator()) {
|
||||
p.initializeMemory(x)
|
||||
p.initializePointee(x)
|
||||
p += 1
|
||||
}
|
||||
return p
|
||||
|
||||
@@ -529,7 +529,7 @@ extension String {
|
||||
start: UnsafeMutablePointer<UTF8.CodeUnit>,
|
||||
utf8Length: Int
|
||||
) {
|
||||
resultStorage.initializeMemory(
|
||||
resultStorage.initializePointee(
|
||||
String._fromWellFormedCodeUnitSequence(UTF8.self,
|
||||
input: UnsafeBufferPointer(start: start, length: utf8Length)))
|
||||
}
|
||||
|
||||
@@ -151,9 +151,9 @@ public struct ${Self}<Pointee>
|
||||
/// - Postcondition: The pointee is initalized; the value should eventually
|
||||
/// be destroyed or moved from to avoid leaks.
|
||||
// FIXME: add tests (since the `count` has been added)
|
||||
public func initializeMemory(newValue: Pointee, count: Int = 1) {
|
||||
public func initializePointee(newValue: Pointee, count: Int = 1) {
|
||||
_debugRequire(count >= 0,
|
||||
"${Self}.initializeMemory with negative count")
|
||||
"${Self}.initializePointee with negative count")
|
||||
// Must not use `initializeFrom` with a `Collection` as that will introduce
|
||||
// a cycle.
|
||||
for offset in 0..<count {
|
||||
@@ -249,7 +249,7 @@ public struct ${Self}<Pointee>
|
||||
Pointee.self, self._rawValue, source._rawValue, count._builtinWordValue)
|
||||
// This builtin is equivalent to:
|
||||
// for i in 0..<count {
|
||||
// (self + i).initializeMemory((source + i).move())
|
||||
// (self + i).initializePointee((source + i).move())
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public struct ${Self}<Pointee>
|
||||
// var src = source + count
|
||||
// var dst = self + count
|
||||
// while dst != self {
|
||||
// (--dst).initializeMemory((--src).move())
|
||||
// (--dst).initializePointee((--src).move())
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ public struct ${Self}<Pointee>
|
||||
Pointee.self, self._rawValue, source._rawValue, count._builtinWordValue)
|
||||
// This builtin is equivalent to:
|
||||
// for i in 0..<count {
|
||||
// (self + i).initializeMemory(source[i])
|
||||
// (self + i).initializePointee(source[i])
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ public struct ${Self}<Pointee>
|
||||
///
|
||||
/// - Postcondition: The memory is uninitialized.
|
||||
public func deinitializePointee(count count: Int = 1) {
|
||||
_debugRequire(count >= 0, "${Self}.deinitializeMemory with negative count")
|
||||
_debugRequire(count >= 0, "${Self}.deinitializePointee with negative count")
|
||||
// FIXME: optimization should be implemented, where if the `count` value
|
||||
// is 1, the `Builtin.destroy(Pointee.self, _rawValue)` gets called.
|
||||
Builtin.destroyArray(Pointee.self, _rawValue, count._builtinWordValue)
|
||||
|
||||
@@ -131,8 +131,8 @@ struct ContainsP { var p: P }
|
||||
func exerciseArrayValueWitnesses<T>(value: T) {
|
||||
let buf = UnsafeMutablePointer<T>(allocatingCapacity: 5)
|
||||
|
||||
(buf + 0).initializeMemory(value)
|
||||
(buf + 1).initializeMemory(value)
|
||||
(buf + 0).initializePointee(value)
|
||||
(buf + 1).initializePointee(value)
|
||||
|
||||
Builtin.copyArray(T.self, (buf + 2)._rawValue, buf._rawValue, 2._builtinWordValue)
|
||||
Builtin.takeArrayBackToFront(T.self, (buf + 1)._rawValue, buf._rawValue, 4._builtinWordValue)
|
||||
|
||||
@@ -20,7 +20,7 @@ a.value.name = "DaveA"
|
||||
a.value.locations.append("Princeton")
|
||||
a.value.locations.append("San Jose")
|
||||
for x in 0..<10 {
|
||||
(a.baseAddress + x).initializeMemory(x)
|
||||
(a.baseAddress + x).initializePointee(x)
|
||||
}
|
||||
|
||||
print("buffer has storage: \(a.storage != nil)")
|
||||
|
||||
@@ -108,7 +108,7 @@ final class TestManagedBuffer<T> : ManagedBuffer<LengthAndCapacity,T> {
|
||||
|
||||
withUnsafeMutablePointerToElements {
|
||||
(p: UnsafeMutablePointer<T>)->() in
|
||||
(p + length).initializeMemory(x)
|
||||
(p + length).initializePointee(x)
|
||||
}
|
||||
self.length = length + 2
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ print(_reflect(randomUnsafeMutablePointerString).summary)
|
||||
|
||||
// CHECK-NEXT: Hello panda
|
||||
var sanePointerString = UnsafeMutablePointer<String>(allocatingCapacity: 1)
|
||||
sanePointerString.initializeMemory("Hello panda")
|
||||
sanePointerString.initializePointee("Hello panda")
|
||||
print(_reflect(sanePointerString.pointee).summary)
|
||||
sanePointerString.deinitializePointee()
|
||||
sanePointerString.deallocateCapacity(1)
|
||||
|
||||
@@ -142,40 +142,40 @@ func checkPointerCorrectness(check: Check,
|
||||
let ptr = UnsafeMutablePointer<Missile>(allocatingCapacity: 4)
|
||||
switch check {
|
||||
case .RightOverlap:
|
||||
ptr.initializeMemory(Missile(1))
|
||||
(ptr + 1).initializeMemory(Missile(2))
|
||||
ptr.initializePointee(Missile(1))
|
||||
(ptr + 1).initializePointee(Missile(2))
|
||||
if withMissiles {
|
||||
(ptr + 2).initializeMemory(Missile(3))
|
||||
(ptr + 2).initializePointee(Missile(3))
|
||||
}
|
||||
f(ptr + 1)(ptr, count: 2)
|
||||
expectEqual(1, ptr[1].number)
|
||||
expectEqual(2, ptr[2].number)
|
||||
case .LeftOverlap:
|
||||
if withMissiles {
|
||||
ptr.initializeMemory(Missile(1))
|
||||
ptr.initializePointee(Missile(1))
|
||||
}
|
||||
(ptr + 1).initializeMemory(Missile(2))
|
||||
(ptr + 2).initializeMemory(Missile(3))
|
||||
(ptr + 1).initializePointee(Missile(2))
|
||||
(ptr + 2).initializePointee(Missile(3))
|
||||
f(ptr)(ptr + 1, count: 2)
|
||||
expectEqual(2, ptr[0].number)
|
||||
expectEqual(3, ptr[1].number)
|
||||
case .Disjoint:
|
||||
if withMissiles {
|
||||
ptr.initializeMemory(Missile(0))
|
||||
(ptr + 1).initializeMemory(Missile(1))
|
||||
ptr.initializePointee(Missile(0))
|
||||
(ptr + 1).initializePointee(Missile(1))
|
||||
}
|
||||
(ptr + 2).initializeMemory(Missile(2))
|
||||
(ptr + 3).initializeMemory(Missile(3))
|
||||
(ptr + 2).initializePointee(Missile(2))
|
||||
(ptr + 3).initializePointee(Missile(3))
|
||||
f(ptr)(ptr + 2, count: 2)
|
||||
expectEqual(2, ptr[0].number)
|
||||
expectEqual(3, ptr[1].number)
|
||||
// backwards
|
||||
let ptr2 = UnsafeMutablePointer<Missile>(allocatingCapacity: 4)
|
||||
ptr2.initializeMemory(Missile(0))
|
||||
(ptr2 + 1).initializeMemory(Missile(1))
|
||||
ptr2.initializePointee(Missile(0))
|
||||
(ptr2 + 1).initializePointee(Missile(1))
|
||||
if withMissiles {
|
||||
(ptr2 + 2).initializeMemory(Missile(2))
|
||||
(ptr2 + 3).initializeMemory(Missile(3))
|
||||
(ptr2 + 2).initializePointee(Missile(2))
|
||||
(ptr2 + 3).initializePointee(Missile(3))
|
||||
}
|
||||
f(ptr2 + 2)(ptr2, count: 2)
|
||||
expectEqual(0, ptr2[2].number)
|
||||
|
||||
@@ -44,13 +44,13 @@ class Vector<T> {
|
||||
let size = Int(Builtin.sizeof(T.self))
|
||||
let newbase = UnsafeMutablePointer<T>(c_malloc(newcapacity * size))
|
||||
for i in 0..<length {
|
||||
(newbase + i).initializeMemory((base+i).take())
|
||||
(newbase + i).initializePointee((base+i).take())
|
||||
}
|
||||
c_free(base)
|
||||
base = newbase
|
||||
capacity = newcapacity
|
||||
}
|
||||
(base+length).initializeMemory(elem)
|
||||
(base+length).initializePointee(elem)
|
||||
length += 1
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ func pointerArithmetic(x: UnsafeMutablePointer<Int>, y: UnsafeMutablePointer<Int
|
||||
|
||||
func genericPointerArithmetic<T>(x: UnsafeMutablePointer<T>, i: Int, t: T) -> UnsafeMutablePointer<T> {
|
||||
let p = x + i
|
||||
p.initializeMemory(t)
|
||||
p.initializePointee(t)
|
||||
}
|
||||
|
||||
func passPointerToClosure(f: UnsafeMutablePointer<Float> -> Int) -> Int { }
|
||||
|
||||
@@ -121,7 +121,7 @@ struct FixedSizedRefArrayOfOptional<T>
|
||||
{
|
||||
buffer = Storage.Buffer(Storage.self, capacity, capacity)
|
||||
for var i = 0; i < capacity; ++i {
|
||||
(buffer.baseAddress + i).initializeMemory(.None)
|
||||
(buffer.baseAddress + i).initializePointee(.None)
|
||||
}
|
||||
|
||||
buffer.value = capacity
|
||||
|
||||
@@ -35,7 +35,7 @@ extension Q_SequenceDefaults {
|
||||
var p = baseAddress
|
||||
var iter = self.iterator()
|
||||
while let element = iter.next() {
|
||||
p.initializeMemory(element)
|
||||
p.initializePointee(element)
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ extension Q_SequenceDefaults {
|
||||
var p = baseAddress
|
||||
var iter = self.iterator()
|
||||
while let element = iter.next() {
|
||||
p.initializeMemory(element)
|
||||
p.initializePointee(element)
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ extension Q_SequenceDefaults {
|
||||
var p = baseAddress
|
||||
var iter = self.iterator()
|
||||
while let element = iter.next() {
|
||||
p.initializeMemory(element)
|
||||
p.initializePointee(element)
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ extension Q_SequenceDefaults {
|
||||
var p = baseAddress
|
||||
var iter = self.iterator()
|
||||
while let element? = iter.next() {
|
||||
p.initializeMemory(element)
|
||||
p.initializePointee(element)
|
||||
p += 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func sliceConcurrentAppendThread(tid: ThreadID) {
|
||||
|
||||
StringTestSuite.test("SliceConcurrentAppend") {
|
||||
barrierVar = UnsafeMutablePointer(allocatingCapacity: 1)
|
||||
barrierVar.initializeMemory(_stdlib_pthread_barrier_t())
|
||||
barrierVar.initializePointee(_stdlib_pthread_barrier_t())
|
||||
var ret = _stdlib_pthread_barrier_init(barrierVar, nil, 2)
|
||||
expectEqual(0, ret)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user