UDK 3.2.7 C/C++ API Reference

osl/conditn.hxx

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 #ifndef _OSL_CONDITN_HXX_
00021 #define _OSL_CONDITN_HXX_
00022 
00023 #ifdef __cplusplus
00024 
00025 #include <osl/time.h>
00026 
00027 #include <osl/conditn.h>
00028 
00029 
00030 namespace osl
00031 {
00032 
00033     class Condition
00034     {
00035     public:
00036 
00037         enum Result
00038         {
00039             result_ok      = osl_cond_result_ok,
00040             result_error   = osl_cond_result_error,
00041             result_timeout = osl_cond_result_timeout
00042         };
00043 
00044         /* Create a condition.
00045          */
00046         Condition()
00047         {
00048             condition = osl_createCondition();
00049         }
00050 
00051         /* Release the OS-structures and free condition data-structure.
00052          */
00053         ~Condition()
00054         {
00055             osl_destroyCondition(condition);
00056         }
00057 
00058         /* Release all waiting threads, check returns sal_True.
00059          */
00060         void set()
00061         {
00062             osl_setCondition(condition);
00063         }
00064 
00065         /* Reset condition to false: wait() will block, check() returns sal_False.
00066          */
00067         void reset() {
00068             osl_resetCondition(condition);
00069         }
00070 
00073         Result wait(const TimeValue *pTimeout = 0)
00074         {
00075             return (Result) osl_waitCondition(condition, pTimeout);
00076         }
00077 
00080         sal_Bool check()
00081         {
00082             return osl_checkCondition(condition);
00083         }
00084 
00085 
00086     private:
00087         oslCondition condition;
00088 
00095         Condition(const Condition&);
00096 
00103         Condition(oslCondition condition);
00104 
00108         Condition& operator= (const Condition&);
00109 
00113         Condition& operator= (oslCondition);
00114     };
00115 
00116 }
00117 
00118 #endif  /* __cplusplus */
00119 #endif  /* _OSL_CONDITN_HXX_ */
00120 
00121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines