
#include "protectedobject.h"
#include "globals.h"


ProtectedObject::ProtectedObject() {

	UNIV_NEW_SEMA(_sema, global_sema_handle);
	if (!UNIV_SEMA_VALID(_sema))
	  {
	    cerr << "Failed to create semaphore! This will lead to trouble, probably." << endl;
	  }
}

ProtectedObject::~ProtectedObject() {

  if (!UNIV_SEMA_VALID(_sema))
    UNIV_FREE_SEMA(_sema, global_sema_handle);
}

ProtectedObject& ProtectedObject::CopyFrom(const ProtectedObject &) {

	cerr << "Error: ProtectedObject::CopyFrom() called" << endl;
	exit(-1);

	return *this;
}
