[jitsi-dev] [jitsi/libjitsi] Synchronizer: concurrency fixes (#147)


#1

Except if you use Atomic* or volatile, you have to lock/synchronize for both writing and reading.
You can view, comment on, or merge this pull request online at:

  https://github.com/jitsi/libjitsi/pull/147

-- Commit Summary --

  * SynchronizerImpl: use ConcurrentHashMap
  * SynchronizerImpl: fix more concurrency issues

-- File Changes --

    M src/org/jitsi/impl/neomedia/recording/SynchronizerImpl.java (109)

-- Patch Links --

https://github.com/jitsi/libjitsi/pull/147.patch
https://github.com/jitsi/libjitsi/pull/147.diff

···

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/147


#2

The first commit is fine. In the second one, the unsynchronized that were there before reads are okay because the conditions is checked against after obtaining a lock. The valid changes in the second commit are thus only the parameter validations.

···

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/147#issuecomment-218825276


#3

This type of check is only ok if you have an initial state (set in the constructor) and you never go back to it, and that's not the case here (see removeMapping).
synchronised ensure atomicity but also visibility between threads

···

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/147#issuecomment-219084658


#4

@bgrozev informed me that this code isn't even in use. As I'm lacking time to go through it again, I'm closing this PR.

···

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/147#issuecomment-226614487


#5

Closed #147.

···

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/147#event-695222571