Android 开发基础 Thread-safe methods
2010-07-15 21:18:00 来源:WEB开发网核心提示:subclass that implements RPC methods) would be called from threads in the pool. Since services can have more than one client, more than one pool thread can enga
subclass that implements RPC methods) would be called from threads in the pool.
Since services can have more than one client, more than one pool thread can
engage the same IBinder method at the same time. IBinder methods must,
therefore, be implemented to be thread-safe.
Similarly, a content provider can receive data requests that originate in other processes. Although the ContentResolver and ContentProvider classes hide the details of how the interprocess communication is managed, ContentProvider methods that respond to those requests — the methods query(), insert(), delete(), update(), and getType() — are called from a pool of threads in the content provider’s process, not the main thread of the process. Since these methods may be called from any number of threads at the same time, they too must be implemented to be thread-safe.
更多精彩
赞助商链接