2 * Copyright (c) 2002 Frodo
3 * Portions Copyright (c) by the authors of ffmpeg and xvid
4 * Copyright (C) 2002-2018 Team Kodi
5 * This file is part of Kodi - https://kodi.tv
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 * See LICENSES/README.md for more information.
13 #include "threads/CriticalSection.h"
18 * This implements a "guard" pattern for exiting all locks
19 * currently being held by the current thread and restoring
20 * those locks on destruction.
22 * This class can be used on a CCriticalSection that isn't owned
23 * by this thread in which case it will do nothing.
27 CCriticalSection
& sec
;
30 inline explicit CSingleExit(CCriticalSection
& cs
) : sec(cs
), count(cs
.exit()) { }
31 inline ~CSingleExit() { sec
.restore(count
); }