Androidソースコードの多くの機能には、LI、LPw、LPrで終わる固有の名前があります。関数名とその目的を理解することがより役立つので、頭字語が何を意味するのか誰にでも分かります。Androidソースコードの機能固有の名称
例:
PackageManagerService.installPackageLI()
PackageManagerService.updatePermissionsLPw()
Settings.peekPackageLPr()
感謝。
Androidソースコードの多くの機能には、LI、LPw、LPrで終わる固有の名前があります。関数名とその目的を理解することがより役立つので、頭字語が何を意味するのか誰にでも分かります。Androidソースコードの機能固有の名称
例:
PackageManagerService.installPackageLI()
PackageManagerService.updatePermissionsLPw()
Settings.peekPackageLPr()
感謝。
ラインを見234:
234 // Lock for state used when installing and doing other long running
235 // operations. Methods that must be called with this lock held have
236 // the prefix "LI".
237 final Object mInstallLock = new Object();
これはLIの最初の出現でした... – Snicolas
LPRは受け入れ答えが既にありLPWがmPackages
// Keys are String (package name), values are Package. This also serves
// as the lock for the global state. Methods that must be called with
// this lock held have the prefix "LP".
final HashMap<String, PackageParser.Package> mPackages =
new HashMap<String, PackageParser.Package>();
への書き込みアクセスを意味mPackagesへの読み取りアクセス
を意味するが、私は以下の情報が他のユーザーに役立つと考えています。ただLPR、LPW、LIおよびLIFサフィックスを理解しようと文書で下記見つかった:
内部的には二つの重要なロックがあります
1) **mPackages** is used to guard all in-memory parsed package details
and other related state. It is a fine-grained lock that should only be
held momentarily, as it's one of the most contended locks in the system.
2) **mInstallLock** is used to guard all installd access, whose
operations typically involve heavy lifting of application data on disk.
Since installd is single-threaded, and it's operations can often be slow,
this lock should never be acquired while already holding mPackages .
Conversely, it's safe to acquire mPackages momentarily while already
holding mInstallLock.
Many internal methods rely on the caller to hold the appropriate locks, and
this contract is expressed through method name suffixes:
fooLI(): the caller must hold mInstallLock
fooLIF(): the caller must hold mInstallLock and the package being modified
must be frozen
fooLPr(): the caller must hold mPackages for reading
fooLPw(): the caller must hold mPackages for writing
あなたが任意の具体的な例を持っていますか? –
@TylerTreat編集された質問 – Jake