EventFlag.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _SUPPORT_EVENT_FLAG_H
00014 #define _SUPPORT_EVENT_FLAG_H
00015 
00021 #include <support/SupportDefs.h>
00022 #include <support/Value.h>
00023 
00024 #include <pthread.h>
00025 
00026 #if _SUPPORTS_NAMESPACE
00027 namespace palmos {
00028 namespace support {
00029 #endif
00030 
00035 class SEventFlag
00036 {
00037 public:
00038                 SEventFlag();
00039                 ~SEventFlag();                  // dtor not virtal
00040     
00041     status_t    Set();
00042     status_t    Clear();
00043     status_t    Wait(nsecs_t timeout = -1);
00044     
00045 private:
00046     explicit    SEventFlag(const SEventFlag &o);
00047 
00048     uint32_t        m_bits;
00049     pthread_cond_t  m_cond;
00050     pthread_mutex_t m_mutex;
00051 };
00052 
00055 #if _SUPPORTS_NAMESPACE
00056 } } // namespace palmos::support
00057 #endif
00058 
00059 #endif // _SUPPORT_EVENT_FLAG_H