Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

ot_posix.h

Go to the documentation of this file.
00001 //                              Package : omnithread
00002 // omnithread/posix.h           Created : 7/94 tjr
00003 //
00004 //    Copyright (C) 2006 Free Software Foundation, Inc.
00005 //    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
00006 //
00007 //    This file is part of the omnithread library
00008 //
00009 //    The omnithread library is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Library General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2 of the License, or (at your option) any later version.
00013 //
00014 //    This library is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Library General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Library General Public
00020 //    License along with this library; if not, write to the Free
00021 //    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
00022 //    02111-1307, USA
00023 //
00024 //
00025 // OMNI thread implementation classes for posix threads
00026 //
00027 
00028 #ifndef __omnithread_posix_h_
00029 #define __omnithread_posix_h_
00030 
00031 #if defined(__alpha__) && defined(__osf1__) || defined(__hpux__)
00032 // stop unnecessary definitions of TRY, etc on OSF
00033 #ifndef EXC_HANDLING
00034 #define EXC_HANDLING
00035 #endif
00036 #endif
00037 
00038 #ifndef __POSIX_NT__
00039 #  include <pthread.h>
00040 #else
00041 #  ifndef WIN32_LEAN_AND_MEAN
00042 #    define WIN32_LEAN_AND_MEAN
00043 #    define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00044 #  endif
00045 #  include <windows.h>
00046 #  include "pthread_nt.h"
00047 #  ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00048 #    undef WIN32_LEAN_AND_MEAN
00049 #    undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00050 #  endif
00051 #endif
00052 
00053 extern "C" void* omni_thread_wrapper(void* ptr);
00054 
00055 #define OMNI_MUTEX_IMPLEMENTATION                       \
00056     pthread_mutex_t posix_mutex;
00057 
00058 #define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
00059     pthread_mutex_lock(&posix_mutex);
00060 
00061 #define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION               \
00062     (pthread_mutex_trylock(&posix_mutex)==0);
00063 
00064 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
00065     pthread_mutex_unlock(&posix_mutex);
00066 
00067 #define OMNI_CONDITION_IMPLEMENTATION                   \
00068     pthread_cond_t posix_cond;
00069 
00070 #define OMNI_SEMAPHORE_IMPLEMENTATION                   \
00071     omni_mutex m;                                       \
00072     omni_condition c;                                   \
00073     int value;                                          \
00074     int max_count;
00075 
00076 #define OMNI_THREAD_IMPLEMENTATION                      \
00077     pthread_t posix_thread;                             \
00078     static int posix_priority(priority_t);              \
00079     friend void* omni_thread_wrapper(void* ptr);
00080 
00081 #endif

Generated on Sat Jul 8 17:04:52 2006 for GNU Radio 2.x by  doxygen 1.4.1