Chris@1729: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1729: Chris@1729: /* Chris@1729: Sonic Visualiser Chris@1729: An audio file viewer and annotation editor. Chris@1729: Centre for Digital Music, Queen Mary, University of London. Chris@1729: Chris@1729: This program is free software; you can redistribute it and/or Chris@1729: modify it under the terms of the GNU General Public License as Chris@1729: published by the Free Software Foundation; either version 2 of the Chris@1729: License, or (at your option) any later version. See the file Chris@1729: COPYING included with this distribution for more information. Chris@1729: */ Chris@1729: Chris@1729: #include "ById.h" Chris@1729: Chris@1729: #include Chris@1729: Chris@1729: #include Chris@1729: Chris@1729: int Chris@1729: WithId::getNextId() Chris@1729: { Chris@1729: static int nextId = 0; Chris@1729: static QMutex mutex; Chris@1729: QMutexLocker locker(&mutex); Chris@1729: int i = nextId; Chris@1729: if (nextId == INT_MAX) { Chris@1729: nextId = INT_MIN; Chris@1729: } Chris@1729: ++nextId; Chris@1729: return i; Chris@1729: }