@act262
2017-05-24T14:25:20.000000Z
字数 577
阅读 1271
AndroidSource
void recycleUnchecked() {// Mark the message as in use while it remains in the recycled object pool.// Clear out all other details.flags = FLAG_IN_USE;what = 0;arg1 = 0;arg2 = 0;obj = null;replyTo = null;sendingUid = -1;when = 0;target = null;callback = null;data = null;synchronized (sPoolSync) {if (sPoolSize < MAX_POOL_SIZE) {// 把当前的Message插入表头next = sPool;sPool = this;sPoolSize++;}}}
public static Message obtain() {synchronized (sPoolSync) {if (sPool != null) {// 从表头取出一个Message,原先下个的Message成为新的表头Message m = sPool;sPool = m.next;m.next = null;m.flags = 0; // clear in-use flagsPoolSize--;return m;}}return new Message();}
