Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
773f2272
Commit
773f2272
authored
11 years ago
by
Keisuke Kuroyanagi
Browse files
Options
Downloads
Patches
Plain Diff
Fix: wrong locking order.
Change-Id: I823912e3979829ad1e825cf91dc5e18f7f0f9cc3
parent
e7ac9003
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+10
-8
10 additions, 8 deletions
...android/inputmethod/latin/ExpandableBinaryDictionary.java
with
10 additions
and
8 deletions
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+
10
−
8
View file @
773f2272
...
...
@@ -84,9 +84,11 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
/** Whether to support dynamically updating the dictionary */
private
final
boolean
mIsUpdatable
;
// TODO: remove, once dynamic operations will be serialized
/** Controls access to the shared binary dictionary file across multiple instances. */
private
final
DictionaryController
mSharedDictionaryController
;
// TODO: remove, once dynamic operations will be serialized
/** Controls access to the local binary dictionary for this instance. */
private
final
DictionaryController
mLocalDictionaryController
=
new
DictionaryController
();
...
...
@@ -446,9 +448,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
private
final
void
syncReloadDictionaryInternal
()
{
// Ensure that only one thread attempts to read or write to the shared binary dictionary
// file at the same time.
m
Local
DictionaryController
.
writeLock
().
lock
();
m
Shared
DictionaryController
.
writeLock
().
lock
();
try
{
m
Shared
DictionaryController
.
writeLock
().
lock
();
m
Local
DictionaryController
.
writeLock
().
lock
();
try
{
final
long
time
=
SystemClock
.
uptimeMillis
();
final
boolean
dictionaryFileExists
=
dictionaryFileExists
();
...
...
@@ -483,10 +485,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
mLocalDictionaryController
.
mLastUpdateTime
=
time
;
}
finally
{
m
Shared
DictionaryController
.
writeLock
().
unlock
();
m
Local
DictionaryController
.
writeLock
().
unlock
();
}
}
finally
{
m
Local
DictionaryController
.
writeLock
().
unlock
();
m
Shared
DictionaryController
.
writeLock
().
unlock
();
}
}
...
...
@@ -519,16 +521,16 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
private
class
AsyncLoadDictionaryToMemoryTask
extends
Thread
{
@Override
public
void
run
()
{
m
Local
DictionaryController
.
write
Lock
().
lock
();
m
Shared
DictionaryController
.
read
Lock
().
lock
();
try
{
m
Shared
DictionaryController
.
read
Lock
().
lock
();
m
Local
DictionaryController
.
write
Lock
().
lock
();
try
{
loadDictionaryAsync
();
}
finally
{
m
Shared
DictionaryController
.
read
Lock
().
unlock
();
m
Local
DictionaryController
.
write
Lock
().
unlock
();
}
}
finally
{
m
Local
DictionaryController
.
write
Lock
().
unlock
();
m
Shared
DictionaryController
.
read
Lock
().
unlock
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment