This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Semaphore { | |
var n: Int | |
init(n: Int) { | |
self.n = n | |
} | |
func P() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Semaphore { | |
var n: Int | |
init(n: Int) { | |
self.n = n | |
} | |
func P() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Semaphore { | |
var n: Int | |
init(n: Int) { | |
self.n = n | |
} | |
func P() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
var ran: Int = 0; | |
var favoredProcess: String = "first" | |
var processOneWantsIn: Bool = false | |
var processTwoWantsIn: Bool = false | |
func processOne(task: () -> Void) { | |
while ran < 50 { | |
processOneWantsIn = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
var n: Int = 0; | |
var favoredProcess: String = "first" | |
var processOneWantsIn: Bool = false | |
var processTwoWantsIn: Bool = false | |
func processOne(task: () -> Void) { | |
while n < 50 { | |
processOneWantsIn = true |
NewerOlder