//
//  lockobject.h
//
//  Created by hark on 2013/07/02.
//  Copyright (c) 2013年 hark. All rights reserved.
//

#ifndef _lockobject_h
#define _lockobject_h

#include <pthread.h>
#include <math.h>
#include <errno.h>

#ifdef __cplusplus

class lockobject {
private:
    pthread_mutex_t *mutex;

public:
    lockobject(const lockobject &);
    lockobject();
    lockobject(::pthread_mutex_t *arg_mutex) : mutex(arg_mutex) {
        ::pthread_mutex_lock(mutex);
    }
    lockobject & operator = (const lockobject &);
    virtual ~lockobject() {
        ::pthread_mutex_unlock(mutex);
    }

};

#endif /* __cplusplus */

#endif
