Skip to content

Commit

Permalink
Merge pull request #192 from CodaFi/amdahls-law
Browse files Browse the repository at this point in the history
Amdahls Law
  • Loading branch information
CodaFi committed May 14, 2015
2 parents 9a1425b + 262d526 commit 00b000c
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 187 deletions.
23 changes: 0 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,6 @@ let left = divideLeftMultiplyRight.apply(Either.left(4)) // 2
let right = divideLeftMultiplyRight.apply(Either.right(7)) // 14
```

**Concurrency**

```swift
import class Swiftz.Chan

//: A Channel is an unbounded FIFO stream of values with special semantics
//: for reads and writes.
let chan : Chan<Int> = Chan()

//: All writes to the Channel always succeed. The Channel now contains `1`.
chan.write(1) // happens immediately

//: Reads to non-empty Channels occur immediately. The Channel is now empty.
let x1 = chan.read()

//: But if we read from an empty Channel the read blocks until we write to the Channel again.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * Double(NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
chan.write(2) // Causes the read to suceed and unblocks the reading thread.
})

let x2 = chan.read() // Blocks until the dispatch block is executed and the Channel becomes non-empty.
```

Operators
---------

Expand Down
24 changes: 0 additions & 24 deletions Swiftz-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,13 @@
84A88F2D1A70C77B003D53CF /* Tuple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88DE11A70C2B5003D53CF /* Tuple.swift */; };
84A88F2E1A70C77B003D53CF /* TupleExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88DE21A70C2B5003D53CF /* TupleExt.swift */; };
84A88F671A70C7A0003D53CF /* ArrayExtSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ECC1A70C707003D53CF /* ArrayExtSpec.swift */; };
84A88F681A70C7A0003D53CF /* ChanSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ECD1A70C707003D53CF /* ChanSpec.swift */; };
84A88F691A70C7A0003D53CF /* ConcurrentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ECE1A70C707003D53CF /* ConcurrentTests.swift */; };
84A88F6A1A70C7A0003D53CF /* EitherSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ECF1A70C707003D53CF /* EitherSpec.swift */; };
84A88F6B1A70C7A0003D53CF /* FunctorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED01A70C707003D53CF /* FunctorSpec.swift */; };
84A88F6C1A70C7A0003D53CF /* FutureSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED11A70C707003D53CF /* FutureSpec.swift */; };
84A88F6D1A70C7A0003D53CF /* HListSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED21A70C707003D53CF /* HListSpec.swift */; };
84A88F6E1A70C7A0003D53CF /* JSONSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED31A70C707003D53CF /* JSONSpec.swift */; };
84A88F6F1A70C7A0003D53CF /* ListSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED41A70C707003D53CF /* ListSpec.swift */; };
84A88F701A70C7A0003D53CF /* MaybeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED51A70C707003D53CF /* MaybeSpec.swift */; };
84A88F711A70C7A0003D53CF /* MonoidSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED61A70C707003D53CF /* MonoidSpec.swift */; };
84A88F721A70C7A0003D53CF /* MVarSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED71A70C707003D53CF /* MVarSpec.swift */; };
84A88F731A70C7A0003D53CF /* OptionalExtSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED81A70C707003D53CF /* OptionalExtSpec.swift */; };
84A88F741A70C7A0003D53CF /* PartyExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88ED91A70C707003D53CF /* PartyExample.swift */; };
84A88F751A70C7A0003D53CF /* ResultSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88EDA1A70C707003D53CF /* ResultSpec.swift */; };
Expand Down Expand Up @@ -198,17 +194,13 @@
84A88E951A70C649003D53CF /* Optional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = ../Carthage/Checkouts/Swiftx/Swiftx/Optional.swift; sourceTree = "<group>"; };
84A88E961A70C649003D53CF /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Result.swift; path = ../Carthage/Checkouts/Swiftx/Swiftx/Result.swift; sourceTree = "<group>"; };
84A88ECC1A70C707003D53CF /* ArrayExtSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ArrayExtSpec.swift; path = SwiftzTests/ArrayExtSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ECD1A70C707003D53CF /* ChanSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChanSpec.swift; path = SwiftzTests/ChanSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ECE1A70C707003D53CF /* ConcurrentTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConcurrentTests.swift; path = SwiftzTests/ConcurrentTests.swift; sourceTree = SOURCE_ROOT; };
84A88ECF1A70C707003D53CF /* EitherSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EitherSpec.swift; path = SwiftzTests/EitherSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED01A70C707003D53CF /* FunctorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FunctorSpec.swift; path = SwiftzTests/FunctorSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED11A70C707003D53CF /* FutureSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FutureSpec.swift; path = SwiftzTests/FutureSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED21A70C707003D53CF /* HListSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HListSpec.swift; path = SwiftzTests/HListSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED31A70C707003D53CF /* JSONSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSpec.swift; path = SwiftzTests/JSONSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED41A70C707003D53CF /* ListSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListSpec.swift; path = SwiftzTests/ListSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED51A70C707003D53CF /* MaybeSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MaybeSpec.swift; path = SwiftzTests/MaybeSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED61A70C707003D53CF /* MonoidSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MonoidSpec.swift; path = SwiftzTests/MonoidSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED71A70C707003D53CF /* MVarSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MVarSpec.swift; path = SwiftzTests/MVarSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED81A70C707003D53CF /* OptionalExtSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OptionalExtSpec.swift; path = SwiftzTests/OptionalExtSpec.swift; sourceTree = SOURCE_ROOT; };
84A88ED91A70C707003D53CF /* PartyExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PartyExample.swift; path = SwiftzTests/PartyExample.swift; sourceTree = SOURCE_ROOT; };
84A88EDA1A70C707003D53CF /* ResultSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ResultSpec.swift; path = SwiftzTests/ResultSpec.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -273,7 +265,6 @@
isa = PBXGroup;
children = (
84A88F871A70C953003D53CF /* Examples */,
84A88F881A70C967003D53CF /* Concurrent */,
84A88F8A1A70C982003D53CF /* Data */,
84A88F891A70C97C003D53CF /* Ext */,
84A88D611A70C23D003D53CF /* Supporting Files */,
Expand Down Expand Up @@ -412,17 +403,6 @@
name = Examples;
sourceTree = "<group>";
};
84A88F881A70C967003D53CF /* Concurrent */ = {
isa = PBXGroup;
children = (
84A88ECD1A70C707003D53CF /* ChanSpec.swift */,
84A88ECE1A70C707003D53CF /* ConcurrentTests.swift */,
84A88ED11A70C707003D53CF /* FutureSpec.swift */,
84A88ED71A70C707003D53CF /* MVarSpec.swift */,
);
name = Concurrent;
sourceTree = "<group>";
};
84A88F891A70C97C003D53CF /* Ext */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -584,18 +564,14 @@
buildActionMask = 2147483647;
files = (
84A88F671A70C7A0003D53CF /* ArrayExtSpec.swift in Sources */,
84A88F681A70C7A0003D53CF /* ChanSpec.swift in Sources */,
84A88F691A70C7A0003D53CF /* ConcurrentTests.swift in Sources */,
84A88F6A1A70C7A0003D53CF /* EitherSpec.swift in Sources */,
84A88F6B1A70C7A0003D53CF /* FunctorSpec.swift in Sources */,
84A88F6C1A70C7A0003D53CF /* FutureSpec.swift in Sources */,
84BB57671AA12E4300214BC5 /* StateSpec.swift in Sources */,
84A88F6D1A70C7A0003D53CF /* HListSpec.swift in Sources */,
84A88F6E1A70C7A0003D53CF /* JSONSpec.swift in Sources */,
84A88F6F1A70C7A0003D53CF /* ListSpec.swift in Sources */,
84A88F701A70C7A0003D53CF /* MaybeSpec.swift in Sources */,
84A88F711A70C7A0003D53CF /* MonoidSpec.swift in Sources */,
84A88F721A70C7A0003D53CF /* MVarSpec.swift in Sources */,
84A88F731A70C7A0003D53CF /* OptionalExtSpec.swift in Sources */,
84A88F741A70C7A0003D53CF /* PartyExample.swift in Sources */,
84A88F751A70C7A0003D53CF /* ResultSpec.swift in Sources */,
Expand Down
24 changes: 0 additions & 24 deletions Swiftz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@
84A88F9E1A71DF7F003D53CF /* Swiftz.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A88F9D1A71DF7F003D53CF /* Swiftz.h */; settings = {ATTRIBUTES = (Public, ); }; };
84A88FA41A71DF7F003D53CF /* Swiftz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84A88F981A71DF7F003D53CF /* Swiftz.framework */; };
84A88FC91A71DFA0003D53CF /* ArrayExtSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB41A71DFA0003D53CF /* ArrayExtSpec.swift */; };
84A88FCA1A71DFA0003D53CF /* ChanSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB51A71DFA0003D53CF /* ChanSpec.swift */; };
84A88FCB1A71DFA0003D53CF /* ConcurrentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB61A71DFA0003D53CF /* ConcurrentTests.swift */; };
84A88FCC1A71DFA0003D53CF /* EitherSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB71A71DFA0003D53CF /* EitherSpec.swift */; };
84A88FCD1A71DFA0003D53CF /* FunctorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB81A71DFA0003D53CF /* FunctorSpec.swift */; };
84A88FCE1A71DFA0003D53CF /* FutureSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FB91A71DFA0003D53CF /* FutureSpec.swift */; };
84A88FCF1A71DFA0003D53CF /* HListSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBA1A71DFA0003D53CF /* HListSpec.swift */; };
84A88FD01A71DFA0003D53CF /* JSONSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBB1A71DFA0003D53CF /* JSONSpec.swift */; };
84A88FD11A71DFA0003D53CF /* ListSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBC1A71DFA0003D53CF /* ListSpec.swift */; };
84A88FD21A71DFA0003D53CF /* MaybeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBD1A71DFA0003D53CF /* MaybeSpec.swift */; };
84A88FD31A71DFA0003D53CF /* MonoidSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBE1A71DFA0003D53CF /* MonoidSpec.swift */; };
84A88FD41A71DFA0003D53CF /* MVarSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FBF1A71DFA0003D53CF /* MVarSpec.swift */; };
84A88FD51A71DFA0003D53CF /* OptionalExtSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FC01A71DFA0003D53CF /* OptionalExtSpec.swift */; };
84A88FD61A71DFA0003D53CF /* PartyExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FC11A71DFA0003D53CF /* PartyExample.swift */; };
84A88FD71A71DFA0003D53CF /* ResultSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A88FC21A71DFA0003D53CF /* ResultSpec.swift */; };
Expand Down Expand Up @@ -145,17 +141,13 @@
84A88FA31A71DF7F003D53CF /* SwiftzTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftzTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
84A88FA91A71DF7F003D53CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
84A88FB41A71DFA0003D53CF /* ArrayExtSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayExtSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FB51A71DFA0003D53CF /* ChanSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChanSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FB61A71DFA0003D53CF /* ConcurrentTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConcurrentTests.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FB71A71DFA0003D53CF /* EitherSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EitherSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FB81A71DFA0003D53CF /* FunctorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctorSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FB91A71DFA0003D53CF /* FutureSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FutureSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBA1A71DFA0003D53CF /* HListSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HListSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBB1A71DFA0003D53CF /* JSONSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBC1A71DFA0003D53CF /* ListSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBD1A71DFA0003D53CF /* MaybeSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaybeSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBE1A71DFA0003D53CF /* MonoidSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MonoidSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FBF1A71DFA0003D53CF /* MVarSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVarSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FC01A71DFA0003D53CF /* OptionalExtSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionalExtSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FC11A71DFA0003D53CF /* PartyExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PartyExample.swift; sourceTree = "<group>"; usesTabs = 1; };
84A88FC21A71DFA0003D53CF /* ResultSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultSpec.swift; sourceTree = "<group>"; usesTabs = 1; };
Expand Down Expand Up @@ -297,7 +289,6 @@
isa = PBXGroup;
children = (
84A890591A71E1D7003D53CF /* Examples */,
84A890581A71E1C5003D53CF /* Concurrent */,
84A8905A1A71E1EE003D53CF /* Data */,
84A890571A71E1B5003D53CF /* Ext */,
84A88FA81A71DF7F003D53CF /* Supporting Files */,
Expand Down Expand Up @@ -415,17 +406,6 @@
name = Ext;
sourceTree = "<group>";
};
84A890581A71E1C5003D53CF /* Concurrent */ = {
isa = PBXGroup;
children = (
84A88FB51A71DFA0003D53CF /* ChanSpec.swift */,
84A88FB61A71DFA0003D53CF /* ConcurrentTests.swift */,
84A88FB91A71DFA0003D53CF /* FutureSpec.swift */,
84A88FBF1A71DFA0003D53CF /* MVarSpec.swift */,
);
name = Concurrent;
sourceTree = "<group>";
};
84A890591A71E1D7003D53CF /* Examples */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -649,26 +629,22 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84A88FCA1A71DFA0003D53CF /* ChanSpec.swift in Sources */,
84A88FD21A71DFA0003D53CF /* MaybeSpec.swift in Sources */,
84A88FD91A71DFA0003D53CF /* ShapeExample.swift in Sources */,
84A88FDC1A71DFA0003D53CF /* TupleExtSpec.swift in Sources */,
84A88FCB1A71DFA0003D53CF /* ConcurrentTests.swift in Sources */,
84A88FD61A71DFA0003D53CF /* PartyExample.swift in Sources */,
84BB57641AA12D2200214BC5 /* StateSpec.swift in Sources */,
84A88FCF1A71DFA0003D53CF /* HListSpec.swift in Sources */,
84A88FDB1A71DFA0003D53CF /* ThoseSpec.swift in Sources */,
84A88FDD1A71DFA0003D53CF /* UserExample.swift in Sources */,
84A88FC91A71DFA0003D53CF /* ArrayExtSpec.swift in Sources */,
84A88FCE1A71DFA0003D53CF /* FutureSpec.swift in Sources */,
84A88FD51A71DFA0003D53CF /* OptionalExtSpec.swift in Sources */,
84A88FCD1A71DFA0003D53CF /* FunctorSpec.swift in Sources */,
84A88FD11A71DFA0003D53CF /* ListSpec.swift in Sources */,
84A88FD01A71DFA0003D53CF /* JSONSpec.swift in Sources */,
84A88FD71A71DFA0003D53CF /* ResultSpec.swift in Sources */,
84A88FD31A71DFA0003D53CF /* MonoidSpec.swift in Sources */,
84A88FDA1A71DFA0003D53CF /* StringExtSpec.swift in Sources */,
84A88FD41A71DFA0003D53CF /* MVarSpec.swift in Sources */,
84A88FCC1A71DFA0003D53CF /* EitherSpec.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
5 changes: 5 additions & 0 deletions Swiftz/Chan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public final class Chan<A> {
let cond : UnsafeMutablePointer<pthread_cond_t>
let matt : UnsafeMutablePointer<pthread_mutexattr_t>

@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
public init() {
self.stream = []
var mattr : UnsafeMutablePointer<pthread_mutexattr_t> = UnsafeMutablePointer.alloc(sizeof(pthread_mutexattr_t))
Expand All @@ -38,6 +39,7 @@ public final class Chan<A> {
}

/// Writes a value to a channel.
@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
public func write(a : A) {
pthread_mutex_lock(mutex)
stream.append(a)
Expand All @@ -46,6 +48,7 @@ public final class Chan<A> {
}

/// Reads a value from the channel.
@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
public func read() -> A {
pthread_mutex_lock(mutex)
while (stream.isEmpty) {
Expand All @@ -58,11 +61,13 @@ public final class Chan<A> {
}

/// Write | Writes a value to a channel.
@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
public func <-<A>(chan : Chan<A>, value : A) -> Void {
chan.write(value)
}

/// Read | Reads a value from the channel.
@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
public prefix func <-<A>(chan : Chan<A>) -> A {
return chan.read()
}
1 change: 1 addition & 0 deletions Swiftz/ExecutionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public protocol ExecutionContext {
/// Computes a value for a Future given a work block.
///
/// When work concludes this function must execute Future.sig(_:) to fulfill the Future.
@availability(*, deprecated=2.1, message="Concurrency primitives are being moved to Concurrent.framework")
func submit<A>(x: Future<A>, work: () -> A)
}
Loading

0 comments on commit 00b000c

Please sign in to comment.