/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
//////////////////////////////////////////////////////////////////////////
//
// This file contains the linux implementation of the Event class
//////////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "Event.h"
#include "SPtr.h"
#include <pthread.h>
#include <cerrno>
#include <iostream>
class OSEvent_s
{
public:
{
_set = false;
}
~OSEvent_s()
{
}
bool _set;
};
class OSEvent
{
public:
OSEvent()
{
}
~OSEvent()
{
}
};
{
/*
_osEvent->ose->_set = false;
pthread_mutex_init(&_osEvent->ose->_mut, NULL);
pthread_cond_init(&_osEvent->ose->_cond, NULL);
*/
}
{
/*
_osEvent->_mut = rhs._osEvent->_mut;
_osEvent->_cond = rhs._osEvent->_cond;
*/
}
{
/*
pthread_cond_destroy(&_osEvent->ose->_cond);
pthread_mutex_destroy(&_osEvent->ose->_mut);
*/
delete _osEvent;
}
{
int retcode = 0;
if (msecs_p != WAIT_INFINITE) {
//printf("@@@@ Event (%p) wait (cond %p), set: %d (to %d)\n",
// this, &_osEvent->_ose->_cond, _osEvent->_ose->_set, msecs_p);
&timeout);
//printf("@@@@ Event (%p) after wait, set: %d\n", this, _osEvent->_ose->_set);
}
//printf("@@@@ Event (%p) after wait, set: %d\n", this, _osEvent->_ose->_set);
return false;
} else {
return true;
}
} else {
//printf("@@@@ Event (%p) wait (cond %p), set: %d\n",
// this, &_osEvent->_ose->_cond, _osEvent->_ose->_set);
}
//printf("@@@@ Event (%p) after wait, set: %d\n", this, _osEvent->_ose->_set);
return true;
}
}
{
//printf("@@@@ Event (%p) set (cond %p)\n", this, &_osEvent->_ose->_cond);
}
{
// only way to reset the condition is to destroy it and restart it
}