@@ -25,13 +25,13 @@ extension String {
2525// different non-shared strings that point to the same shared buffer.
2626
2727enum ThreadID {
28- case Master
29- case Slave
28+ case Leader
29+ case Follower
3030}
3131
3232var barrierVar : UnsafeMutablePointer < _stdlib_pthread_barrier_t > = nil
3333var sharedString : String = " "
34- var slaveString : String = " "
34+ var followerString : String = " "
3535
3636func barrier( ) {
3737 var ret = _stdlib_pthread_barrier_wait ( barrierVar)
@@ -41,7 +41,7 @@ func barrier() {
4141func sliceConcurrentAppendThread( tid: ThreadID ) {
4242 for i in 0 ..< 100 {
4343 barrier ( )
44- if tid == . Master {
44+ if tid == . Leader {
4545 // Get a fresh buffer.
4646 sharedString = " "
4747 sharedString. appendContentsOf ( " abc " )
@@ -57,7 +57,7 @@ func sliceConcurrentAppendThread(tid: ThreadID) {
5757 barrier ( )
5858
5959 // Append to the private string.
60- if tid == . Master {
60+ if tid == . Leader {
6161 privateString. appendContentsOf ( " def " )
6262 } else {
6363 privateString. appendContentsOf ( " ghi " )
@@ -74,14 +74,14 @@ func sliceConcurrentAppendThread(tid: ThreadID) {
7474 expectEqual ( " abc " , sharedString)
7575
7676 // Verify that only one thread took ownership of the buffer.
77- if tid == . Slave {
78- slaveString = privateString
77+ if tid == . Follower {
78+ followerString = privateString
7979 }
8080 barrier ( )
81- if tid == . Master {
81+ if tid == . Leader {
8282 expectTrue (
8383 ( privateString. bufferID == sharedString. bufferID) !=
84- ( slaveString . bufferID == sharedString. bufferID) )
84+ ( followerString . bufferID == sharedString. bufferID) )
8585 }
8686 }
8787}
@@ -93,9 +93,9 @@ StringTestSuite.test("SliceConcurrentAppend") {
9393 expectEqual ( 0 , ret)
9494
9595 let ( createRet1, tid1) = _stdlib_pthread_create_block (
96- nil , sliceConcurrentAppendThread, . Master )
96+ nil , sliceConcurrentAppendThread, . Leader )
9797 let ( createRet2, tid2) = _stdlib_pthread_create_block (
98- nil , sliceConcurrentAppendThread, . Slave )
98+ nil , sliceConcurrentAppendThread, . Follower )
9999
100100 expectEqual ( 0 , createRet1)
101101 expectEqual ( 0 , createRet2)
0 commit comments