Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JackoPlane
Copy link
Contributor

No description provided.

justinpawela pushed a commit that referenced this pull request Apr 2, 2016
func addData(data: NSData) {
dispatch_async(self.lock, {
let id = ++self.currentMaxID
let id: UInt = UInt(self.currentMaxID += 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JackoPlane
I updated this while merging your PR, but I wanted to point out that your update in this instance was not quite right.

UInt(self.currentMaxID += 1) always evaluates to 0, because the expression self.currentMaxID += 1 does not return anything -- or more accurately, returns () -- and UInt(()) evaluates to 0. Thus id would always be 0, even while currentMaxID is being incremented, which is not what we want!

Anyway, I updated it while merging to correct the behavior. Otherwise, thanks for the PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah! Nice catch @justinpawela! Thanks for merging so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants