All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AutoVLock.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
AutoVLock.h
Qore Programming Language
Copyright 2003 - 2013 David Nichols
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QORE_AUTOVLOCK_H
#define _QORE_AUTOVLOCK_H
class AbstractSmartLock;
class AutoVLock {
private:
// pointer to lock currently held
QoreThreadLock* m;
// pointer to object to dereference
QoreObject* o;
public:
// pointer to ExceptionSink object for use with object notifications
ExceptionSink* xsink;
private:
struct qore_avl_private* priv;
DLLLOCAL AutoVLock(const AutoVLock&);
DLLLOCAL AutoVLock& operator=(const AutoVLock&);
DLLLOCAL void* operator new(size_t);
public:
DLLEXPORT AutoVLock(ExceptionSink* n_xsink);
DLLEXPORT ~AutoVLock();
DLLEXPORT operator bool() const;
DLLEXPORT void del();
DLLLOCAL void set(QoreThreadLock* n_m);
DLLLOCAL void set(QoreObject* n_o, QoreThreadLock* n_m);
DLLLOCAL QoreThreadLock* get() const;
DLLLOCAL QoreObject* getObject() const;
DLLLOCAL void clear();
DLLLOCAL void addMemberNotification(QoreObject* o, const char* member);
};
#endif