inline T *pop() { T *result;
inline bool pop(long timeout_ms, T **res) {  if (!semaphore.wait(timeout_ms)) {  *res = 0; return false; }   lock.lock(); *res = queue.front(); queue.pop(); count--; lock.unlock();
        inline T *pop()        {                T *result;                semaphore.wait();                lock.lock();                result = queue.front();                queue.pop();                lock.unlock();                return result;        };