/************************************************************************* * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: conditn.cxx,v $ * * $Revision: 1.4 $ * * last change: $Author: vg $ $Date: 2006-06-02 12:41:52 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. * * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2005 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * 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., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * ************************************************************************/ #ifndef _OSL_TIME_H_ #include #endif #include #include using namespace vos; VOS_IMPLEMENT_CLASSINFO(VOS_CLASSNAME(OCondition, vos), VOS_NAMESPACE(OCondition, vos), VOS_NAMESPACE(OObject, vos), 0); /// initial state of condition is not set OCondition::OCondition() { m_Condition= osl_createCondition(); } OCondition::~OCondition() { osl_destroyCondition(m_Condition); } /// set condition to sal_True => wait() will not block, check() returns sal_True void OCondition::set() { osl_setCondition(m_Condition); } /// set condition to sal_False => wait() will block, check() returns sal_False void OCondition::reset() { osl_resetCondition(m_Condition); } /** Blocks if condition is not set
If condition has been destroyed prematurely, wait() will return with sal_False. */ OCondition::TResult OCondition::wait(const TimeValue* pTimeout) { return (TResult)osl_waitCondition(m_Condition, pTimeout); } /** sal_True: condition is set
sal_False: condition is not set
does not block */ sal_Bool OCondition::check() { return osl_checkCondition(m_Condition); }