Poll* Poll::prepare(int opts) { bool allowNonCallbacks = opts & ALOOPER_PREPARE_ALLOW_NON_CALLBACKS; Poll* poller = Poll::getForThread(); if (NULL == poller) { poller = new Poll(allowNonCallbacks); Poll::setForThread(poller); } if (poller->getAllowNonCallbacks() != allowNonCallbacks) { ALOGW("Poll already prepared for this thread with a different value for the " "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option."); } return poller; }