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

Generated on Tue Mar 29 18:57:04 2005 for GNU Radio 2.x by  doxygen 1.4.2