From 0e8a37bdee0151d87d811c1e4039960deaa23847 Mon Sep 17 00:00:00 2001 From: Inari Date: Sat, 5 Dec 2015 01:01:53 +0100 Subject: [PATCH 1/2] Properly fix potentially inconsiderate naming --- .../stdlib/StringSlicesConcurrentAppend.swift | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/validation-test/stdlib/StringSlicesConcurrentAppend.swift b/validation-test/stdlib/StringSlicesConcurrentAppend.swift index bd7ec49eab422..493bfbb7c6a5b 100644 --- a/validation-test/stdlib/StringSlicesConcurrentAppend.swift +++ b/validation-test/stdlib/StringSlicesConcurrentAppend.swift @@ -25,13 +25,13 @@ extension String { // different non-shared strings that point to the same shared buffer. enum ThreadID { - case Leader - case Follower + case Primary + case Replica } var barrierVar: UnsafeMutablePointer<_stdlib_pthread_barrier_t> = nil var sharedString: String = "" -var followerString: String = "" +var replicaString: String = "" func barrier() { var ret = _stdlib_pthread_barrier_wait(barrierVar) @@ -41,7 +41,7 @@ func barrier() { func sliceConcurrentAppendThread(tid: ThreadID) { for i in 0..<100 { barrier() - if tid == .Leader { + if tid == .Primary { // Get a fresh buffer. sharedString = "" sharedString.appendContentsOf("abc") @@ -57,7 +57,7 @@ func sliceConcurrentAppendThread(tid: ThreadID) { barrier() // Append to the private string. - if tid == .Leader { + if tid == .Primary { privateString.appendContentsOf("def") } else { privateString.appendContentsOf("ghi") @@ -66,7 +66,7 @@ func sliceConcurrentAppendThread(tid: ThreadID) { barrier() // Verify that contents look good. - if tid == .Leader { + if tid == .Primary { expectEqual("abcdef", privateString) } else { expectEqual("abcghi", privateString) @@ -74,14 +74,14 @@ func sliceConcurrentAppendThread(tid: ThreadID) { expectEqual("abc", sharedString) // Verify that only one thread took ownership of the buffer. - if tid == .Follower { - followerString = privateString + if tid == .Replica { + replicaString = privateString } barrier() - if tid == .Leader { + if tid == .Primary { expectTrue( (privateString.bufferID == sharedString.bufferID) != - (followerString.bufferID == sharedString.bufferID)) + (replicaString.bufferID == sharedString.bufferID)) } } } @@ -93,9 +93,9 @@ StringTestSuite.test("SliceConcurrentAppend") { expectEqual(0, ret) let (createRet1, tid1) = _stdlib_pthread_create_block( - nil, sliceConcurrentAppendThread, .Leader) + nil, sliceConcurrentAppendThread, .Primary) let (createRet2, tid2) = _stdlib_pthread_create_block( - nil, sliceConcurrentAppendThread, .Follower) + nil, sliceConcurrentAppendThread, .Replica) expectEqual(0, createRet1) expectEqual(0, createRet2) From 199ac1585d3eb61adfd4f9be30f82df5dc6aeea3 Mon Sep 17 00:00:00 2001 From: Inari Date: Sat, 5 Dec 2015 18:31:53 +0100 Subject: [PATCH 2/2] Fix potentially inconsiderate/inaccurate naming --- .../stdlib/StringSlicesConcurrentAppend.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/validation-test/stdlib/StringSlicesConcurrentAppend.swift b/validation-test/stdlib/StringSlicesConcurrentAppend.swift index 493bfbb7c6a5b..a0d1e0b1bf815 100644 --- a/validation-test/stdlib/StringSlicesConcurrentAppend.swift +++ b/validation-test/stdlib/StringSlicesConcurrentAppend.swift @@ -26,12 +26,12 @@ extension String { enum ThreadID { case Primary - case Replica + case Secondary } var barrierVar: UnsafeMutablePointer<_stdlib_pthread_barrier_t> = nil var sharedString: String = "" -var replicaString: String = "" +var secondaryString: String = "" func barrier() { var ret = _stdlib_pthread_barrier_wait(barrierVar) @@ -74,14 +74,14 @@ func sliceConcurrentAppendThread(tid: ThreadID) { expectEqual("abc", sharedString) // Verify that only one thread took ownership of the buffer. - if tid == .Replica { - replicaString = privateString + if tid == .Secondary { + secondaryString = privateString } barrier() if tid == .Primary { expectTrue( (privateString.bufferID == sharedString.bufferID) != - (replicaString.bufferID == sharedString.bufferID)) + (secondaryString.bufferID == sharedString.bufferID)) } } } @@ -95,7 +95,7 @@ StringTestSuite.test("SliceConcurrentAppend") { let (createRet1, tid1) = _stdlib_pthread_create_block( nil, sliceConcurrentAppendThread, .Primary) let (createRet2, tid2) = _stdlib_pthread_create_block( - nil, sliceConcurrentAppendThread, .Replica) + nil, sliceConcurrentAppendThread, .Secondary) expectEqual(0, createRet1) expectEqual(0, createRet2)