00001 /** @file 00002 00003 A brief file description 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 /************************************************************************** 00025 EventNotify.h 00026 00027 Generic event notify mechanism among threads. 00028 00029 **************************************************************************/ 00030 00031 #ifndef EVENT_NOTIFY_H 00032 #define EVENT_NOTIFY_H 00033 00034 #include "ink_thread.h" 00035 00036 class EventNotify 00037 { 00038 public: 00039 EventNotify(); 00040 void signal(void); 00041 int wait(void); 00042 int timedwait(int timeout); // milliseconds 00043 void lock(void); 00044 bool trylock(void); 00045 void unlock(void); 00046 ~EventNotify(); 00047 00048 private: 00049 #ifdef HAVE_EVENTFD 00050 int m_event_fd; 00051 int m_epoll_fd; 00052 #else 00053 ink_cond m_cond; 00054 ink_mutex m_mutex; 00055 #endif 00056 }; 00057 00058 #endif /* EVENT_NOTIFY_H */ 00059 /* vim: set sw=4 ts=4 tw=79 et : */