Skip to main content
Code Review

Return to Question

Question Protected by Mast
grammar edits
Source Link
Ben A
  • 10.8k
  • 5
  • 37
  • 101

AndThis is the SynchronizedValue is this class (basically a wrapper around a GCD serial queue):

And SynchronizedValue is this class (basically a wrapper around a GCD serial queue):

This is the SynchronizedValue class (basically a wrapper around a GCD serial queue):

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

This is a follow-up to this this question.

This is a follow-up to this question.

This is a follow-up to this question.

deleted 78 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

This is a follow-up to this question.

While discussing some details about the code I posted there, I came upon a problem with thread-safety. After searching and trying different things, I reached a potential solution that I now present here. This worked without any problems during my tests, though since thread-safety is not easy, I'd like to ask: is this implementation genuinely thread-safe?

Here's the code:

  • On the computed var keyValues, this line .filter { k in k.value != nil } is needed because a value can become nil while this dict.get { ... } block is running, and since the block is still running, the value hasn't been cleaned out yet (the corresponding DeallocWatcher callback is sitting on the queue waiting for its turn).

Question: I'd like to know if On the computed var keyValues, this line .filter { k in k.value != nil } is thread-safeneeded because a value can become nil while this dict.get { ... } block is running, and since the block is still running, the value hasn't been cleaned out yet (the corresponding DeallocWatcher callback is sitting on the queue waiting for its turn).

This is a follow-up to this question. While discussing some details about the code I posted there, I came upon a problem with thread-safety. After searching and trying different things, I reached a potential solution that I now present here. This worked without any problems during my tests, though since thread-safety is not easy, I'd like to ask: is this implementation genuinely thread-safe?

Here's the code:

  • On the computed var keyValues, this line .filter { k in k.value != nil } is needed because a value can become nil while this dict.get { ... } block is running, and since the block is still running, the value hasn't been cleaned out yet (the corresponding DeallocWatcher callback is sitting on the queue waiting for its turn).

Question: I'd like to know if this is thread-safe.

This is a follow-up to this question.

While discussing some details about the code I posted there, I came upon a problem with thread-safety. After searching and trying different things, I reached a potential solution that I now present here. This worked without any problems during my tests, though since thread-safety is not easy, I'd like to ask: is this implementation genuinely thread-safe?

On the computed var keyValues, this line .filter { k in k.value != nil } is needed because a value can become nil while this dict.get { ... } block is running, and since the block is still running, the value hasn't been cleaned out yet (the corresponding DeallocWatcher callback is sitting on the queue waiting for its turn).

Notice removed Draw attention by Community Bot
Bounty Ended with no winning answer by Community Bot
This was not relevant to the question
Source Link
Marc-Andre
  • 6.8k
  • 5
  • 39
  • 65
Loading
Notice added Draw attention by Alex
Bounty Started worth 50 reputation by Alex
Tweeted twitter.com/#!/StackCodeReview/status/584584796128600065
added 14 characters in body
Source Link
Alex
  • 581
  • 4
  • 8
Loading
Source Link
Alex
  • 581
  • 4
  • 8
Loading
default

AltStyle によって変換されたページ (->オリジナル) /