2012-03-19 14 views
1

Androidソースコードの多くの機能には、LI、LPw、LPrで終わる固有の名前があります。関数名とその目的を理解することがより役立つので、頭字語が何を意味するのか誰にでも分かります。Androidソースコードの機能固有の名称

例:

PackageManagerService.installPackageLI()
PackageManagerService.updatePermissionsLPw()
Settings.peekPackageLPr()

感謝。

+0

あなたが任意の具体的な例を持っていますか? –

+0

@TylerTreat編集された質問 – Jake

答えて

1

ラインを見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(); 
+0

これはLIの最初の出現でした... – Snicolas

1

奇妙なソースコードを見ているようです。 grepcodeをご存知ですか?

+0

を見てください@タイラーのように例を挙げてくださいsaid – Snicolas

0

への書き込みアクセスを意味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 
関連する問題