Merged r10501:10505 from michaelld/omnithread into trunk. Moves omnithread header...
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 25 Feb 2009 19:04:35 +0000 (19:04 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 25 Feb 2009 19:04:35 +0000 (19:04 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10506 221aa14e-8319-0410-a670-987f0aec2ac5

53 files changed:
config/grc_omnithread.m4
gcell/apps/benchmark_dma.cc
gcell/apps/benchmark_nop.cc
gcell/apps/benchmark_roundtrip.cc
gcell/lib/runtime/gc_client_thread_info.h
gnuradio-core/src/lib/io/gr_file_sink_base.h
gnuradio-core/src/lib/io/gr_udp_sink.h
gnuradio-core/src/lib/io/gr_udp_source.h
gnuradio-core/src/lib/io/gr_wavfile_sink.h
gnuradio-core/src/lib/io/gri_logger.h
gnuradio-core/src/lib/runtime/gr_msg_queue.h
gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
gr-audio-osx/src/mld_threads.h
gr-audio-portaudio/src/audio_portaudio_sink.cc
gr-audio-portaudio/src/audio_portaudio_sink.h
gr-audio-portaudio/src/audio_portaudio_source.cc
gr-audio-portaudio/src/audio_portaudio_source.h
mblock/src/include/mblock/msg_queue.h
mblock/src/include/mblock/runtime.h
mblock/src/include/mblock/time.h
mblock/src/lib/mb_runtime_base.h
mblock/src/lib/mb_runtime_thread_per_block.cc
mblock/src/lib/mb_worker.h
omnithread/Makefile.am
omnithread/gnuradio/Makefile.am [new file with mode: 0644]
omnithread/gnuradio/omni_time.h [new file with mode: 0644]
omnithread/gnuradio/omnithread.h [new file with mode: 0644]
omnithread/gnuradio/ot_VxThread.h [new file with mode: 0644]
omnithread/gnuradio/ot_mach.h [new file with mode: 0644]
omnithread/gnuradio/ot_nt.h [new file with mode: 0644]
omnithread/gnuradio/ot_posix.h [new file with mode: 0644]
omnithread/gnuradio/ot_pthread_nt.h [new file with mode: 0644]
omnithread/gnuradio/ot_solaris.h [new file with mode: 0644]
omnithread/mach.cc
omnithread/nt.cc
omnithread/omni_time.cc
omnithread/omni_time.h [deleted file]
omnithread/omnithread.h [deleted file]
omnithread/ot_VxThread.h [deleted file]
omnithread/ot_mach.h [deleted file]
omnithread/ot_nt.h [deleted file]
omnithread/ot_posix.h [deleted file]
omnithread/ot_pthread_nt.h [deleted file]
omnithread/ot_solaris.h [deleted file]
omnithread/posix.cc
omnithread/solaris.cc
omnithread/vxWorks.cc
pmt/src/lib/pmt_pool.h
usrp/host/lib/legacy/mld_threads.h
usrp2/host/lib/control.cc
usrp2/host/lib/control.h
usrp2/host/lib/ring.h
usrp2/host/lib/usrp2_thread.h

index 3e52c659a8ddc49e369f584ea167872866a5ba09..1bcedebe183e4dc82168bacba7408ef09d25ba7c 100644 (file)
@@ -35,6 +35,7 @@ AC_DEFUN([GRC_OMNITHREAD],[
 
     AC_CONFIG_FILES([ \
         omnithread/Makefile \
+        omnithread/gnuradio/Makefile \
         omnithread/gnuradio-omnithread.pc
     ])
 
index bce1953a345acf1a73c7885da7300c8d5c62fae2..a84defe3709c305f9dff93d4a785dc80f18750aa 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 #include <gcell/gc_job_manager.h>
-#include <omni_time.h>
+#include <gnuradio/omni_time.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdio.h>
index 10f9d4c5a1ab276a8851d2889200272e56359786..dee46c84208e708e41b1aa4acdcd75871e2cedf7 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 #include <gcell/gc_job_manager.h>
-#include <omni_time.h>
+#include <gnuradio/omni_time.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdio.h>
index 85af03a089b68575952b2480f8fc321e78260437..8ba37c968e168a8ea6014e94bc3a30593561658f 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 #include <gcell/gc_job_manager.h>
-#include <omni_time.h>
+#include <gnuradio/omni_time.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdio.h>
index fbb35d966c706feea7b7acf4377226cf433e6074..9f46ecca77f15a3adcf6948257f3ee42b40110fb 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef INCLUDED_GC_CLIENT_THREAD_INFO_H
 #define INCLUDED_GC_CLIENT_THREAD_INFO_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <boost/utility.hpp>
 
 enum gc_ct_state {
index c848818f828b3ad2513865182fc22da3d1849f34..f36f5ac978be203ec77d88f54aa1111b7239675d 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef INCLUDED_GR_FILE_SINK_BASE_H
 #define INCLUDED_GR_FILE_SINK_BASE_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <cstdio>
 
 /*!
index e59380011b6ba17c62d65a12ccaa116ed21fae67..99f1b29353a9845bfaabbb227fdadb64b1754765 100644 (file)
@@ -24,7 +24,7 @@
 #define INCLUDED_GR_UDP_SINK_H
 
 #include <gr_sync_block.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #if defined(HAVE_SOCKET)
 #include <sys/socket.h>
 #include <arpa/inet.h>
index a4403c3d6da8e4fcfd1a3e2801dccdb74226299a..049740159819531e58118de21eedd3b3aaff2c34 100644 (file)
@@ -24,7 +24,7 @@
 #define INCLUDED_GR_UDP_SOURCE_H
 
 #include <gr_sync_block.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #if defined(HAVE_SOCKET)
 #include <sys/socket.h>
 #include <arpa/inet.h>
index 3fa06f202f4da3e4958ed1c843084d82e852b291..9429165f6065dacdc23c674b912261412aba553d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <gr_sync_block.h>
 #include <gr_file_sink_base.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 
 class gr_wavfile_sink;
 typedef boost::shared_ptr<gr_wavfile_sink> gr_wavfile_sink_sptr;
index da54e56a2949bb7ed1707ec2d5d4e9f70fa3734c..e5caf7d06ac804a5d323e12beb004a291668e2e8 100644 (file)
@@ -23,7 +23,7 @@
 #define INCLUDED_GRI_LOGGER_H
 
 #include <stddef.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <gr_buffer.h>
 
 class gri_log_poster;
index 38556b3cae967c826afcdefd07505867037084e3..f965887e16454d63709833e23e18c65c32a49400 100644 (file)
@@ -23,7 +23,7 @@
 #define INCLUDED_GR_MSG_QUEUE_H
 
 #include <gr_msg_handler.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 
 class gr_msg_queue;
 typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr;
index dc0b232a7db8ff9af2a193a506a475cf302a3e1c..3295f849e42a331553c2366d3371b9cfe91f05a1 100644 (file)
@@ -32,7 +32,7 @@
   typedef boost::mutex                 mutex;
   typedef boost::mutex::scoped_lock    scoped_lock;
 #else
-  #include <omnithread.h>
+  #include <gnuradio/omnithread.h>
   typedef omni_mutex                   mutex;
   typedef omni_mutex_lock              scoped_lock;
 #endif
index a59a928634229c9d71f185aa4bcebdeca85ad85e..d2fb4ea7c0d68c50b84ebc87b097a2bc1cd7f93b 100644 (file)
@@ -29,7 +29,7 @@
 
 #define __macos__
 #ifdef _USE_OMNI_THREADS_
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #else
 #include <pthread.h>
 #endif
index 49c76a5f1299f6daf26c111c2eccc80156f79df3..cfdc6302af4fdbd6e6e8eba8e06d18787894d21f 100644 (file)
@@ -32,7 +32,7 @@
 #include <unistd.h>
 #include <stdexcept>
 #include <gri_portaudio.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <string.h>
 
 #define        LOGGING   0             // define to 0 or 1
index cc301050d6792ce17d4886223aeeac7229e4701d..1ac8edc84d76a7fcb4c5127c53a577b98dd46653 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <gr_sync_block.h>
 #include <gr_buffer.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <string>
 #include <portaudio.h>
 #include <stdexcept>
index 4ea4eeb9c9be7e2ae7753f79c13fc6e9f884ea1f..29d63a8edf58225504931d3fece6dccc6095c4af 100644 (file)
@@ -32,7 +32,7 @@
 #include <unistd.h>
 #include <stdexcept>
 #include <gri_portaudio.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <string.h>
 
 #define        LOGGING 0               // define to 0 or 1
index c132268c807d3fde8e159cf096f4d394c59ac6e7..8bb4a02a78ede42be99de87f04fc7b7aff29336a 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <gr_sync_block.h>
 #include <gr_buffer.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <string>
 #include <portaudio.h>
 #include <stdexcept>
index 31ff65a51f9b62746c96e4f9150c9af314329be9..a23397081a37a438388e4f0632125619221a6675 100644 (file)
@@ -22,7 +22,7 @@
 #define INCLUDED_MB_MSG_QUEUE_H
 
 #include <mblock/common.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <mblock/time.h>
 
 /*!
index 4236e346fdefd59ab1be6c04c5eab552e33b4e3e..4d9d6736bc7709acb18fe3b7cd0cd933a1c9c76b 100644 (file)
@@ -22,7 +22,7 @@
 #define INCLUDED_MB_RUNTIME_H
 
 #include <mblock/common.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 
 /*!
  * \brief Public constructor (factory) for mb_runtime objects.
index cba6be78518dd94ea226b20fab663e904af20954..630fa845c1bfae1b83cc0b9af25d13b0185a8128 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef INCLUDED_MB_TIME_H
 #define INCLUDED_MB_TIME_H
 
-#include <omni_time.h>
+#include <gnuradio/omni_time.h>
 typedef omni_time mb_time;
 
 #endif /* INCLUDED_MB_TIME_H */
index 019662bc2252aef6d10dc35d4aa4db975f6971b2..b88a9ca4e99ce29d0a1af1637ca5ef004b75f295 100644 (file)
@@ -23,7 +23,7 @@
 #define INCLUDED_MB_RUNTIME_BASE_H
 
 #include <mblock/runtime.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <mblock/time.h>
 
 /*
index d12014a16e4d54bac6749a926be946084728f441..ed292ee7c9438b96daea7ff85d7f4c3ee0f90a1f 100644 (file)
@@ -28,7 +28,7 @@
 #include <mblock/class_registry.h>
 #include <mblock/exception.h>
 #include <mb_worker.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <iostream>
 #include <mb_msg_accepter_msgq.h>
 
index b840ae557ecb3c24603dface638c15af0600a626..9831de926068b4e88afb60b971ce0ba638b6da69 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef INCLUDED_MB_WORKER_H
 #define INCLUDED_MB_WORKER_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <mblock/common.h>
 #include <mblock/class_registry.h>
 
index d0dde72b2a27d3691c6f0765d06b5d4a38947569..88df2714da9b4f0a5b3af36500391ab8505a2688 100644 (file)
@@ -21,6 +21,8 @@
 
 include $(top_srcdir)/Makefile.common
 
+SUBDIRS = gnuradio
+
 # This is the omnithread package,
 #   extracted from the omniORB-4.0.1 distribution
 
@@ -66,13 +68,3 @@ EXTRA_DIST =                         \
        threaddata.cc                   \
        vxWorks.cc                      \
        dir.mk
-
-grinclude_HEADERS =                    \
-       omnithread.h                    \
-       omni_time.h                     \
-       ot_mach.h                       \
-       ot_nt.h                         \
-       ot_posix.h                      \
-       ot_pthread_nt.h                 \
-       ot_solaris.h                    \
-       ot_VxThread.h                   
diff --git a/omnithread/gnuradio/Makefile.am b/omnithread/gnuradio/Makefile.am
new file mode 100644 (file)
index 0000000..1ec5612
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# Copyright 2009 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+grinclude_HEADERS =                    \
+       omnithread.h                    \
+       omni_time.h                     \
+       ot_mach.h                       \
+       ot_nt.h                         \
+       ot_posix.h                      \
+       ot_pthread_nt.h                 \
+       ot_solaris.h                    \
+       ot_VxThread.h                   
diff --git a/omnithread/gnuradio/omni_time.h b/omnithread/gnuradio/omni_time.h
new file mode 100644 (file)
index 0000000..bfb1516
--- /dev/null
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_OMNI_TIME_H
+#define INCLUDED_OMNI_TIME_H
+
+struct omni_time {
+  long int d_secs;     // seconds.
+  long int d_nsecs;    // nanoseconds.  Always in [0, 1e9-1]
+
+  omni_time() : d_secs(0), d_nsecs(0) {}
+  omni_time(long secs, long nanosecs=0) : d_secs(secs), d_nsecs(nanosecs) {}
+
+  // N.B., this only makes sense for differences between times.
+  // Double doesn't have enough bits to precisely represent an absolute time.
+  omni_time(double secs);
+
+  // N.B. This only makes sense for differences between times.
+  // Double doesn't have enough bits to precisely represent an absolute time.
+  double double_time() const { return (double)d_secs + d_nsecs * 1e-9; }
+
+  /*!
+   * \brief Return an absolute time suitable for use with
+   * schedule_one_shot_timeout & schedule_periodic_timeout
+   *
+   * The return value is the current time plus the given relative offset.
+   */
+  static omni_time time(const omni_time &relative_offset = omni_time());
+};
+
+
+inline static bool
+operator<(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs < y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs < y.d_nsecs));
+}
+
+inline static bool
+operator>(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs > y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs > y.d_nsecs));
+}
+
+inline static bool
+operator>=(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs > y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs >= y.d_nsecs));
+}
+
+inline static bool
+operator<=(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs < y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs <= y.d_nsecs));
+}
+
+inline static bool
+operator==(const omni_time &x, const omni_time &y)
+{
+  return (x.d_secs == y.d_secs && x.d_nsecs == y.d_nsecs);
+}
+
+
+omni_time operator+(const omni_time &x, const omni_time &y);
+omni_time operator+(const omni_time &x, double y);
+omni_time operator-(const omni_time &x, const omni_time &y);
+omni_time operator-(const omni_time &x, double y);
+
+#endif /* INCLUDED_OMNI_TIME_H */
diff --git a/omnithread/gnuradio/omnithread.h b/omnithread/gnuradio/omnithread.h
new file mode 100644 (file)
index 0000000..8e8162b
--- /dev/null
@@ -0,0 +1,626 @@
+// -*- Mode: C++; -*-
+//                             Package : omnithread
+// omnithread.h                        Created : 7/94 tjr
+//
+//    Copyright (C) 2006 Free Software Foundation, Inc.
+//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
+//
+//    This file is part of the omnithread library
+//
+//    The omnithread library is free software; you can redistribute it and/or
+//    modify it under the terms of the GNU Library General Public
+//    License as published by the Free Software Foundation; either
+//    version 2 of the License, or (at your option) any later version.
+//
+//    This library is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//    Library General Public License for more details.
+//
+//    You should have received a copy of the GNU Library General Public
+//    License along with this library; if not, write to the Free
+//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+//    02110-1301, USA
+//
+
+//
+// Interface to OMNI thread abstraction.
+//
+// This file declares classes for threads and synchronisation objects
+// (mutexes, condition variables and counting semaphores).
+//
+// Wherever a seemingly arbitrary choice has had to be made as to the interface
+// provided, the intention here has been to be as POSIX-like as possible.  This
+// is why there is no semaphore timed wait, for example.
+//
+
+#ifndef __omnithread_h_
+#define __omnithread_h_
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+class omni_mutex;
+class omni_condition;
+class omni_semaphore;
+class omni_thread;
+
+//
+// OMNI_THREAD_EXPOSE can be defined as public or protected to expose the
+// implementation class - this may be useful for debugging.  Hopefully this
+// won't change the underlying structure which the compiler generates so that
+// this can work without recompiling the library.
+//
+
+#ifndef OMNI_THREAD_EXPOSE
+#define OMNI_THREAD_EXPOSE private
+#endif
+
+//
+// Include implementation-specific header file.
+//
+// This must define 4 CPP macros of the form OMNI_x_IMPLEMENTATION for mutex,
+// condition variable, semaphore and thread.  Each should define any
+// implementation-specific members of the corresponding classes.
+//
+
+
+//
+// For now, we assume they've always got a Posix Threads implementation.
+// If not, it'll take some configure hacking to sort it out, along with
+// the relevant libraries to link with, etc.
+//
+
+#if !defined(OMNITHREAD_POSIX) && !defined(OMNITHREAD_NT) && defined HAVE_CONFIG_H
+// #include <config.h>      // No, No, No!  Never include <config.h> from a header
+#endif
+
+#if defined(OMNITHREAD_POSIX)
+#include <gnuradio/ot_posix.h>
+
+#elif defined(OMNITHREAD_NT)
+#include <gnuradio/ot_nt.h>
+
+#ifdef _MSC_VER
+
+// Using MSVC++ to compile. If compiling library as a DLL,
+// define _OMNITHREAD_DLL. If compiling as a statuc library, define
+// _WINSTATIC
+// If compiling an application that is to be statically linked to omnithread,
+// define _WINSTATIC (if the application is  to be dynamically linked, 
+// there is no need to define any of these macros).
+
+#if defined (_OMNITHREAD_DLL) && defined(_WINSTATIC)
+#error "Both _OMNITHREAD_DLL and _WINSTATIC are defined."
+#elif defined(_OMNITHREAD_DLL)
+#define _OMNITHREAD_NTDLL_ __declspec(dllexport)
+#elif !defined(_WINSTATIC)
+#define _OMNITHREAD_NTDLL_ __declspec(dllimport)
+#elif defined(_WINSTATIC)
+#define _OMNITHREAD_NTDLL_
+#endif
+ // _OMNITHREAD_DLL && _WINSTATIC
+
+#else
+
+// Not using MSVC++ to compile
+#define _OMNITHREAD_NTDLL_
+
+#endif
+ // _MSC_VER
+#elif defined(__vxWorks__)
+#include <gnuradio/ot_VxThread.h>
+
+#elif defined(__sunos__)
+#if __OSVERSION__ != 5
+// XXX Workaround for SUN C++ compiler (seen on 4.2) Template.DB code
+//     regeneration bug. See omniORB2/CORBA_sysdep.h for details.
+#if !defined(__SUNPRO_CC) || __OSVERSION__ != '5'
+#error "Only SunOS 5.x or later is supported."
+#endif
+#endif
+#ifdef UseSolarisThreads
+#include <gnuradio/ot_solaris.h>
+#else
+#include <gnuradio/ot_posix.h>
+#endif
+
+#elif defined(__rtems__)
+#include <gnuradio/ot_posix.h>
+#include <sched.h>
+
+#elif defined(__macos__)
+#include <gnuradio/ot_posix.h>
+#include <sched.h>
+
+#else
+#error "No implementation header file"
+#endif
+
+
+#if !defined(__WIN32__)
+#define _OMNITHREAD_NTDLL_
+#endif
+
+#if (!defined(OMNI_MUTEX_IMPLEMENTATION)        || \
+     !defined(OMNI_MUTEX_LOCK_IMPLEMENTATION)   || \
+     !defined(OMNI_MUTEX_TRYLOCK_IMPLEMENTATION)|| \
+     !defined(OMNI_MUTEX_UNLOCK_IMPLEMENTATION) || \
+     !defined(OMNI_CONDITION_IMPLEMENTATION)    || \
+     !defined(OMNI_SEMAPHORE_IMPLEMENTATION)    || \
+     !defined(OMNI_THREAD_IMPLEMENTATION))
+#error "Implementation header file incomplete"
+#endif
+
+
+//
+// This exception is thrown in the event of a fatal error.
+//
+
+class _OMNITHREAD_NTDLL_ omni_thread_fatal {
+public:
+    int error;
+    omni_thread_fatal(int e = 0) : error(e) {}
+};
+
+
+//
+// This exception is thrown when an operation is invoked with invalid
+// arguments.
+//
+
+class _OMNITHREAD_NTDLL_ omni_thread_invalid {};
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Mutex
+//
+///////////////////////////////////////////////////////////////////////////
+
+class _OMNITHREAD_NTDLL_ omni_mutex {
+
+public:
+    omni_mutex(void);
+    ~omni_mutex(void);
+
+    inline void lock(void)    { OMNI_MUTEX_LOCK_IMPLEMENTATION   }
+    inline void unlock(void)  { OMNI_MUTEX_UNLOCK_IMPLEMENTATION }
+    inline int trylock(void)  { return OMNI_MUTEX_TRYLOCK_IMPLEMENTATION }
+       // if mutex is unlocked, lock it and return 1 (true).
+       // If it's already locked then return 0 (false).
+
+    inline void acquire(void) { lock(); }
+    inline void release(void) { unlock(); }
+       // the names lock and unlock are preferred over acquire and release
+       // since we are attempting to be as POSIX-like as possible.
+
+    friend class omni_condition;
+
+private:
+    // dummy copy constructor and operator= to prevent copying
+    omni_mutex(const omni_mutex&);
+    omni_mutex& operator=(const omni_mutex&);
+
+OMNI_THREAD_EXPOSE:
+    OMNI_MUTEX_IMPLEMENTATION
+};
+
+//
+// As an alternative to:
+// {
+//   mutex.lock();
+//   .....
+//   mutex.unlock();
+// }
+//
+// you can use a single instance of the omni_mutex_lock class:
+//
+// {
+//   omni_mutex_lock l(mutex);
+//   ....
+// }
+//
+// This has the advantage that mutex.unlock() will be called automatically
+// when an exception is thrown.
+//
+
+class _OMNITHREAD_NTDLL_ omni_mutex_lock {
+    omni_mutex& mutex;
+public:
+    omni_mutex_lock(omni_mutex& m) : mutex(m) { mutex.lock(); }
+    ~omni_mutex_lock(void) { mutex.unlock(); }
+private:
+    // dummy copy constructor and operator= to prevent copying
+    omni_mutex_lock(const omni_mutex_lock&);
+    omni_mutex_lock& operator=(const omni_mutex_lock&);
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Condition variable
+//
+///////////////////////////////////////////////////////////////////////////
+
+class _OMNITHREAD_NTDLL_ omni_condition {
+
+    omni_mutex* mutex;
+
+public:
+    omni_condition(omni_mutex* m);
+       // constructor must be given a pointer to an existing mutex. The
+       // condition variable is then linked to the mutex, so that there is an
+       // implicit unlock and lock around wait() and timed_wait().
+
+    ~omni_condition(void);
+
+    void wait(void);
+       // wait for the condition variable to be signalled.  The mutex is
+       // implicitly released before waiting and locked again after waking up.
+       // If wait() is called by multiple threads, a signal may wake up more
+       // than one thread.  See POSIX threads documentation for details.
+
+    int timedwait(unsigned long secs, unsigned long nanosecs = 0);
+       // timedwait() is given an absolute time to wait until.  To wait for a
+       // relative time from now, use omni_thread::get_time. See POSIX threads
+       // documentation for why absolute times are better than relative.
+       // Returns 1 (true) if successfully signalled, 0 (false) if time
+       // expired.
+
+    void signal(void);
+       // if one or more threads have called wait(), signal wakes up at least
+       // one of them, possibly more.  See POSIX threads documentation for
+       // details.
+
+    void broadcast(void);
+       // broadcast is like signal but wakes all threads which have called
+       // wait().
+
+private:
+    // dummy copy constructor and operator= to prevent copying
+    omni_condition(const omni_condition&);
+    omni_condition& operator=(const omni_condition&);
+
+OMNI_THREAD_EXPOSE:
+    OMNI_CONDITION_IMPLEMENTATION
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Counting (or binary) semaphore
+//
+///////////////////////////////////////////////////////////////////////////
+
+class _OMNITHREAD_NTDLL_ omni_semaphore {
+
+public:
+    // if max_count == 1, you've got a binary semaphore.
+    omni_semaphore(unsigned int initial = 1, unsigned int max_count = 0x7fffffff);
+    ~omni_semaphore(void);
+
+    void wait(void);
+       // if semaphore value is > 0 then decrement it and carry on. If it's
+       // already 0 then block.
+
+    int trywait(void);
+       // if semaphore value is > 0 then decrement it and return 1 (true).
+       // If it's already 0 then return 0 (false).
+
+    void post(void);
+       // if any threads are blocked in wait(), wake one of them up. Otherwise
+       // increment the value of the semaphore.
+
+private:
+    // dummy copy constructor and operator= to prevent copying
+    omni_semaphore(const omni_semaphore&);
+    omni_semaphore& operator=(const omni_semaphore&);
+
+OMNI_THREAD_EXPOSE:
+    OMNI_SEMAPHORE_IMPLEMENTATION
+};
+
+//
+// A helper class for semaphores, similar to omni_mutex_lock above.
+//
+
+class _OMNITHREAD_NTDLL_ omni_semaphore_lock {
+    omni_semaphore& sem;
+public:
+    omni_semaphore_lock(omni_semaphore& s) : sem(s) { sem.wait(); }
+    ~omni_semaphore_lock(void) { sem.post(); }
+private:
+    // dummy copy constructor and operator= to prevent copying
+    omni_semaphore_lock(const omni_semaphore_lock&);
+    omni_semaphore_lock& operator=(const omni_semaphore_lock&);
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Thread
+//
+///////////////////////////////////////////////////////////////////////////
+
+class _OMNITHREAD_NTDLL_ omni_thread {
+
+public:
+
+    enum priority_t {
+       PRIORITY_LOW,
+       PRIORITY_NORMAL,
+       PRIORITY_HIGH
+    };
+
+    enum state_t {
+       STATE_NEW,              // thread object exists but thread hasn't
+                               // started yet.
+       STATE_RUNNING,          // thread is running.
+       STATE_TERMINATED        // thread has terminated but storage has not
+                               // been reclaimed (i.e. waiting to be joined).
+    };
+
+    //
+    // Constructors set up the thread object but the thread won't start until
+    // start() is called. The create method can be used to construct and start
+    // a thread in a single call.
+    //
+
+    omni_thread(void (*fn)(void*), void* arg = NULL,
+               priority_t pri = PRIORITY_NORMAL);
+    omni_thread(void* (*fn)(void*), void* arg = NULL,
+               priority_t pri = PRIORITY_NORMAL);
+       // these constructors create a thread which will run the given function
+       // when start() is called.  The thread will be detached if given a
+       // function with void return type, undetached if given a function
+       // returning void*. If a thread is detached, storage for the thread is
+       // reclaimed automatically on termination. Only an undetached thread
+       // can be joined.
+
+    void start(void);
+       // start() causes a thread created with one of the constructors to
+       // start executing the appropriate function.
+
+protected:
+
+    omni_thread(void* arg = NULL, priority_t pri = PRIORITY_NORMAL);
+       // this constructor is used in a derived class.  The thread will
+       // execute the run() or run_undetached() member functions depending on
+       // whether start() or start_undetached() is called respectively.
+
+public:
+
+    void start_undetached(void);
+       // can be used with the above constructor in a derived class to cause
+       // the thread to be undetached.  In this case the thread executes the
+       // run_undetached member function.
+
+protected:
+
+    virtual ~omni_thread(void);
+       // destructor cannot be called by user (except via a derived class).
+       // Use exit() or cancel() instead. This also means a thread object must
+       // be allocated with new - it cannot be statically or automatically
+       // allocated. The destructor of a class that inherits from omni_thread
+       // shouldn't be public either (otherwise the thread object can be
+       // destroyed while the underlying thread is still running).
+
+public:
+
+    void join(void**);
+       // join causes the calling thread to wait for another's completion,
+       // putting the return value in the variable of type void* whose address
+       // is given (unless passed a null pointer). Only undetached threads
+       // may be joined. Storage for the thread will be reclaimed.
+
+    void set_priority(priority_t);
+       // set the priority of the thread.
+
+    static omni_thread* create(void (*fn)(void*), void* arg = NULL,
+                              priority_t pri = PRIORITY_NORMAL);
+    static omni_thread* create(void* (*fn)(void*), void* arg = NULL,
+                              priority_t pri = PRIORITY_NORMAL);
+       // create spawns a new thread executing the given function with the
+       // given argument at the given priority. Returns a pointer to the
+       // thread object. It simply constructs a new thread object then calls
+       // start.
+
+    static void exit(void* return_value = NULL);
+       // causes the calling thread to terminate.
+
+    static omni_thread* self(void);
+       // returns the calling thread's omni_thread object.  If the
+       // calling thread is not the main thread and is not created
+       // using this library, returns 0. (But see create_dummy()
+       // below.)
+
+    static void yield(void);
+       // allows another thread to run.
+
+    static void sleep(unsigned long secs, unsigned long nanosecs = 0);
+       // sleeps for the given time.
+
+    static void get_time(unsigned long* abs_sec, unsigned long* abs_nsec,
+                        unsigned long rel_sec = 0, unsigned long rel_nsec=0);
+       // calculates an absolute time in seconds and nanoseconds, suitable for
+       // use in timed_waits on condition variables, which is the current time
+       // plus the given relative offset.
+
+
+    static void stacksize(unsigned long sz);
+    static unsigned long stacksize();
+        // Use this value as the stack size when spawning a new thread.
+        // The default value (0) means that the thread library default is
+        // to be used.
+
+
+    // Per-thread data
+    //
+    // These functions allow you to attach additional data to an
+    // omni_thread. First allocate a key for yourself with
+    // allocate_key(). Then you can store any object whose class is
+    // derived from value_t. Any values still stored in the
+    // omni_thread when the thread exits are deleted.
+    //
+    // These functions are NOT thread safe, so you should be very
+    // careful about setting/getting data in a different thread to the
+    // current thread.
+
+    typedef unsigned int key_t;
+    static key_t allocate_key();
+
+    class value_t {
+    public:
+      virtual ~value_t() {}
+    };
+
+    value_t* set_value(key_t k, value_t* v);
+        // Sets a value associated with the given key. The key must
+        // have been allocated with allocate_key(). If a value has
+        // already been set with the specified key, the old value_t
+        // object is deleted and replaced. Returns the value which was
+        // set, or zero if the key is invalid.
+
+    value_t* get_value(key_t k);
+        // Returns the value associated with the key. If the key is
+        // invalid, or there is no value for the key, returns zero.
+
+    value_t* remove_value(key_t k);
+        // Removes the value associated with the key and returns it.
+        // If the key is invalid, or there is no value for the key,
+        // returns zero.
+
+
+    // Dummy omni_thread
+    //
+    // Sometimes, an application finds itself with threads created
+    // outside of omnithread which must interact with omnithread
+    // features such as the per-thread data. In this situation,
+    // omni_thread::self() would normally return 0. These functions
+    // allow the application to create a suitable dummy omni_thread
+    // object.
+
+    static omni_thread* create_dummy(void);
+        // creates a dummy omni_thread for the calling thread. Future
+        // calls to self() will return the dummy omni_thread. Throws
+        // omni_thread_invalid if this thread already has an
+        // associated omni_thread (real or dummy).
+
+    static void release_dummy();
+        // release the dummy omni_thread for this thread. This
+        // function MUST be called before the thread exits. Throws
+        // omni_thread_invalid if the calling thread does not have a
+        // dummy omni_thread.
+
+    // class ensure_self should be created on the stack. If created in
+    // a thread without an associated omni_thread, it creates a dummy
+    // thread which is released when the ensure_self object is deleted.
+
+    class ensure_self {
+    public:
+      inline ensure_self() : _dummy(0)
+      {
+       _self = omni_thread::self();
+       if (!_self) {
+         _dummy = 1;
+         _self  = omni_thread::create_dummy();
+       }
+      }
+      inline ~ensure_self()
+      {
+       if (_dummy)
+         omni_thread::release_dummy();
+      }
+      inline omni_thread* self() { return _self; }
+    private:
+      omni_thread* _self;
+      int          _dummy;
+    };
+
+
+private:
+
+    virtual void run(void* /*arg*/) {}
+    virtual void* run_undetached(void* /*arg*/) { return NULL; }
+       // can be overridden in a derived class.  When constructed using the
+       // the constructor omni_thread(void*, priority_t), these functions are
+       // called by start() and start_undetached() respectively.
+
+    void common_constructor(void* arg, priority_t pri, int det);
+       // implements the common parts of the constructors.
+
+    omni_mutex mutex;
+       // used to protect any members which can change after construction,
+       // i.e. the following 2 members.
+
+    state_t _state;
+    priority_t _priority;
+
+    static omni_mutex* next_id_mutex;
+    static int next_id;
+    int _id;
+
+    void (*fn_void)(void*);
+    void* (*fn_ret)(void*);
+    void* thread_arg;
+    int detached;
+    int _dummy;
+    value_t**     _values;
+    unsigned long _value_alloc;
+
+    omni_thread(const omni_thread&);
+    omni_thread& operator=(const omni_thread&);
+    // Not implemented
+
+public:
+
+    priority_t priority(void) {
+
+       // return this thread's priority.
+
+       omni_mutex_lock l(mutex);
+       return _priority;
+    }
+
+    state_t state(void) {
+
+       // return thread state (invalid, new, running or terminated).
+
+       omni_mutex_lock l(mutex);
+       return _state;
+    }
+
+    int id(void) { return _id; }
+       // return unique thread id within the current process.
+
+
+    // This class plus the instance of it declared below allows us to execute
+    // some initialisation code before main() is called.
+
+    class _OMNITHREAD_NTDLL_ init_t {
+    public:
+       init_t(void);
+        ~init_t(void);
+    };
+
+    friend class init_t;
+    friend class omni_thread_dummy;
+
+OMNI_THREAD_EXPOSE:
+    OMNI_THREAD_IMPLEMENTATION
+};
+
+#ifndef __rtems__
+static omni_thread::init_t omni_thread_init;
+#else
+// RTEMS calls global Ctor/Dtor in a context that is not
+// a posix thread. Calls to functions to pthread_self() in
+// that context returns NULL. 
+// So, for RTEMS we will make the thread initialization at the
+// beginning of the Init task that has a posix context.
+#endif
+
+#endif
diff --git a/omnithread/gnuradio/ot_VxThread.h b/omnithread/gnuradio/ot_VxThread.h
new file mode 100644 (file)
index 0000000..e96c036
--- /dev/null
@@ -0,0 +1,118 @@
+#ifndef __VXTHREAD_H__
+#define __VXTHREAD_H__
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Project:     omniORB
+%% Filename:    $Filename$
+%% Author:      Guillaume/Bill ARRECKX
+%%              Copyright Wavetek Wandel & Goltermann, Plymouth.
+%% Description: OMNI thread implementation classes for VxWorks threads
+%% Notes:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% $Log$
+%% Revision 1.1  2004/04/10 18:00:52  eb
+%% Initial revision
+%%
+%% Revision 1.1.1.1  2004/03/01 00:20:27  eb
+%% initial checkin
+%%
+%% Revision 1.1  2003/05/25 05:29:04  eb
+%% see ChangeLog
+%%
+%% Revision 1.1.2.1  2003/02/17 02:03:07  dgrisby
+%% vxWorks port. (Thanks Michael Sturm / Acterna Eningen GmbH).
+%%
+%% Revision 1.1.1.1  2002/11/19 14:55:21  sokcevti
+%% OmniOrb4.0.0 VxWorks port
+%%
+%% Revision 1.2  2002/06/14 12:45:50  engeln
+%% unnecessary members in condition removed.
+%% ---
+%%
+%% Revision 1.1.1.1  2002/04/02 10:08:49  sokcevti
+%% omniORB4 initial realease
+%%
+%% Revision 1.1  2001/03/23 16:50:23  hartmut
+%% Initial Version 2.8
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+*/
+
+
+///////////////////////////////////////////////////////////////////////////
+// Includes
+///////////////////////////////////////////////////////////////////////////
+#include <vxWorks.h>
+#include <semLib.h>
+#include <taskLib.h>
+
+
+///////////////////////////////////////////////////////////////////////////
+// Externs prototypes
+///////////////////////////////////////////////////////////////////////////
+extern "C" void omni_thread_wrapper(void* ptr);
+
+
+///////////////////////////////////////////////////////////////////////////
+// Exported macros
+// Note: These are added as private members in each class implementation.
+///////////////////////////////////////////////////////////////////////////
+#define OMNI_MUTEX_IMPLEMENTATION \
+   SEM_ID mutexID;     \
+   bool m_bConstructed;
+
+#define OMNI_CONDITION_IMPLEMENTATION \
+   long waiters_; \
+   SEM_ID waiters_lock_; \
+   SEM_ID sema_;
+
+#define OMNI_SEMAPHORE_IMPLEMENTATION \
+   SEM_ID semID;
+
+#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
+       if(semTake(mutexID, WAIT_FOREVER) != OK)        \
+       {       \
+               throw omni_thread_fatal(errno); \
+       }
+
+#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
+       if(semGive(mutexID) != OK)      \
+       {       \
+               throw omni_thread_fatal(errno); \
+       }
+
+#define OMNI_THREAD_IMPLEMENTATION \
+   friend void omni_thread_wrapper(void* ptr); \
+   static int vxworks_priority(priority_t); \
+   omni_condition *running_cond; \
+   void* return_val; \
+   int tid; \
+   public: \
+   static void attach(void); \
+   static void detach(void); \
+   static void show(void);
+
+
+///////////////////////////////////////////////////////////////////////////
+// Porting macros
+///////////////////////////////////////////////////////////////////////////
+// This is a wrapper function for the 'main' function which does not exists
+//  as such in VxWorks. The wrapper creates a launch function instead,
+//  which spawns the application wrapped in a omni_thread.
+// Argc will always be null.
+///////////////////////////////////////////////////////////////////////////
+#define main( discarded_argc, discarded_argv ) \
+        omni_discard_retval() \
+          { \
+          throw; \
+          } \
+        int omni_main( int argc, char **argv ); \
+        void launch( ) \
+          { \
+          omni_thread* th = new omni_thread( (void(*)(void*))omni_main );\
+          th->start();\
+          }\
+        int omni_main( int argc, char **argv )
+
+
+#endif // ndef __VXTHREAD_H__
diff --git a/omnithread/gnuradio/ot_mach.h b/omnithread/gnuradio/ot_mach.h
new file mode 100644 (file)
index 0000000..7636192
--- /dev/null
@@ -0,0 +1,51 @@
+//                             Package : omnithread
+// omnithread/posix.h          Created : 7/97 lars immisch lars@ibp.de
+//
+//    Copyright (C) 1994,1995,1996, 1997 Immisch, becker & Partner
+//
+//    This file is part of the omnithread library
+//
+//    The omnithread library is free software; you can redistribute it and/or
+//    modify it under the terms of the GNU Library General Public
+//    License as published by the Free Software Foundation; either
+//    version 2 of the License, or (at your option) any later version.
+//
+//    This library is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//    Library General Public License for more details.
+//
+//    You should have received a copy of the GNU Library General Public
+//    License along with this library; if not, write to the Free
+//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+//    02110-1301, USA
+//
+//
+// OMNI thread implementation classes for posix threads
+//
+
+#ifndef __omnithread_mach_h_
+#define __omnithread_mach_h_
+
+#include <mach/cthreads.h>
+
+extern "C" void* omni_thread_wrapper(void* ptr);
+
+#define OMNI_MUTEX_IMPLEMENTATION                      \
+    struct mutex mach_mutex;
+
+#define OMNI_CONDITION_IMPLEMENTATION                  \
+    struct condition mach_cond;
+
+#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
+    omni_mutex m;                                      \
+    omni_condition c;                                  \
+    int value;
+
+
+#define OMNI_THREAD_IMPLEMENTATION                     \
+    cthread_t mach_thread;                             \
+    static int mach_priority(priority_t);              \
+    friend void* omni_thread_wrapper(void* ptr);
+
+#endif
diff --git a/omnithread/gnuradio/ot_nt.h b/omnithread/gnuradio/ot_nt.h
new file mode 100644 (file)
index 0000000..551ccf2
--- /dev/null
@@ -0,0 +1,85 @@
+//                             Package : omnithread
+// omnithread/nt.h             Created : 6/95 tjr
+//
+//    Copyright (C) 1995, 1996, 1997 Olivetti & Oracle Research Laboratory
+//
+//    This file is part of the omnithread library
+//
+//    The omnithread library is free software; you can redistribute it and/or
+//    modify it under the terms of the GNU Library General Public
+//    License as published by the Free Software Foundation; either
+//    version 2 of the License, or (at your option) any later version.
+//
+//    This library is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//    Library General Public License for more details.
+//
+//    You should have received a copy of the GNU Library General Public
+//    License along with this library; if not, write to the Free
+//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+//    02110-1301, USA
+//
+//
+// OMNI thread implementation classes for NT threads.
+//
+
+#ifndef __omnithread_nt_h_
+#define __omnithread_nt_h_
+
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#  define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#endif
+
+#include <windows.h>
+
+#ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#  undef WIN32_LEAN_AND_MEAN
+#  undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#endif
+
+
+#ifndef __BCPLUSPLUS__
+#define OMNI_THREAD_WRAPPER \
+    unsigned __stdcall omni_thread_wrapper(LPVOID ptr);
+#else
+#define OMNI_THREAD_WRAPPER \
+    void _USERENTRY omni_thread_wrapper(void *ptr);
+#endif
+
+extern "C" OMNI_THREAD_WRAPPER;
+
+#define OMNI_MUTEX_IMPLEMENTATION                      \
+    CRITICAL_SECTION crit;
+
+#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
+    EnterCriticalSection(&crit);
+
+#define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION               \
+    TryEnterCriticalSection(&crit);
+
+#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
+    LeaveCriticalSection(&crit);
+
+#define OMNI_CONDITION_IMPLEMENTATION                  \
+    CRITICAL_SECTION crit;                             \
+    omni_thread* waiting_head;                         \
+    omni_thread* waiting_tail;
+
+#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
+    HANDLE nt_sem;
+
+#define OMNI_THREAD_IMPLEMENTATION                     \
+    HANDLE handle;                                     \
+    DWORD nt_id;                                       \
+    void* return_val;                                  \
+    HANDLE cond_semaphore;                             \
+    omni_thread* cond_next;                            \
+    omni_thread* cond_prev;                            \
+    BOOL cond_waiting;                                 \
+    static int nt_priority(priority_t);                        \
+    friend class omni_condition;                       \
+    friend OMNI_THREAD_WRAPPER;
+
+#endif
diff --git a/omnithread/gnuradio/ot_posix.h b/omnithread/gnuradio/ot_posix.h
new file mode 100644 (file)
index 0000000..666ccc0
--- /dev/null
@@ -0,0 +1,81 @@
+//                             Package : omnithread
+// omnithread/posix.h          Created : 7/94 tjr
+//
+//    Copyright (C) 2006 Free Software Foundation, Inc.
+//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
+//
+//    This file is part of the omnithread library
+//
+//    The omnithread library is free software; you can redistribute it and/or
+//    modify it under the terms of the GNU Library General Public
+//    License as published by the Free Software Foundation; either
+//    version 2 of the License, or (at your option) any later version.
+//
+//    This library is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//    Library General Public License for more details.
+//
+//    You should have received a copy of the GNU Library General Public
+//    License along with this library; if not, write to the Free
+//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+//    02110-1301, USA
+//
+//
+// OMNI thread implementation classes for posix threads
+//
+
+#ifndef __omnithread_posix_h_
+#define __omnithread_posix_h_
+
+#if defined(__alpha__) && defined(__osf1__) || defined(__hpux__)
+// stop unnecessary definitions of TRY, etc on OSF
+#ifndef EXC_HANDLING
+#define EXC_HANDLING
+#endif
+#endif
+
+#ifndef __POSIX_NT__
+#  include <pthread.h>
+#else
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#    define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#  endif
+#  include <windows.h>
+#  include "pthread_nt.h"
+#  ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#    undef WIN32_LEAN_AND_MEAN
+#    undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
+#  endif
+#endif
+
+extern "C" void* omni_thread_wrapper(void* ptr);
+
+#define OMNI_MUTEX_IMPLEMENTATION                      \
+    pthread_mutex_t posix_mutex;
+
+#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
+    pthread_mutex_lock(&posix_mutex);
+
+#define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION               \
+    (pthread_mutex_trylock(&posix_mutex)==0);
+
+#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
+    pthread_mutex_unlock(&posix_mutex);
+
+#define OMNI_CONDITION_IMPLEMENTATION                  \
+    pthread_cond_t posix_cond;
+
+#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
+    omni_mutex m;                                      \
+    omni_condition c;                                  \
+    int value;                                         \
+    int max_count;
+
+#define OMNI_THREAD_IMPLEMENTATION                     \
+    pthread_t posix_thread;                            \
+    static int posix_priority(priority_t);             \
+    friend void* omni_thread_wrapper(void* ptr);
+
+#endif
diff --git a/omnithread/gnuradio/ot_pthread_nt.h b/omnithread/gnuradio/ot_pthread_nt.h
new file mode 100644 (file)
index 0000000..324b525
--- /dev/null
@@ -0,0 +1,186 @@
+/*                             Package : omnithread
+   omnithread/pthread_nt.h     Created : Steven Brenneis <brennes1@rjrt.com>
+  
+      Copyright (C) 1998 Steven Brennes
+  
+      This file is part of the omnithread library
+  
+      The omnithread library is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Library General Public
+      License as published by the Free Software Foundation; either
+      version 2 of the License, or (at your option) any later version.
+  
+      This library is distributed in the hope that it will be useful,
+      but WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      Library General Public License for more details.
+  
+      You should have received a copy of the GNU Library General Public
+      License along with this library; if not, write to the Free
+      Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+      02110-1301, USA
+  
+      Posix Threads implementation for Windows NT, version 4.0
+*/
+
+#ifndef PTHREAD_NT_H_INCLUDED
+#define PTHREAD_NT_H_INCLUDED
+
+#include <errno.h>
+
+#ifndef ETIMEDOUT
+//     May have to be changed if NT starts supporting more errno values
+#define ETIMEDOUT 60
+#endif
+
+#undef PthreadDraftVersion
+#define PthreadDraftVersion 10
+
+#define NoNanoSleep
+
+#define PthreadSupportThreadPriority
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _TIMERS_T_
+#define _TIMERS_T_
+       typedef struct timespec {
+               unsigned long tv_sec;
+               long tv_nsec;
+       } timespec_t;
+#endif
+
+typedef char* __pthreadLongString_t;
+typedef void* __pthreadLongAddr_t;
+typedef __pthreadLongAddr_t* __pthreadLongAddr_p;
+typedef long __pthreadLongInt_t;
+typedef unsigned long __pthreadLongUint_t;
+typedef __pthreadLongAddr_p __pthreadTsd_t;
+
+typedef struct __pthread_mutex_t {
+       unsigned int lock;           /* LOCK, SLOW, TYPE, RECURSIVE  */
+       unsigned int valid;          /* Validation info */
+       __pthreadLongString_t name;   /* Name of mutex */
+       unsigned int arg;            /* printf argument for  name */
+       unsigned int depth;          /* Recursive lock depth */
+       unsigned long sequence;       /* Mutex sequence number */
+       unsigned long owner;          /* Current owner (if known */
+       __pthreadLongAddr_t block;          /* Pointer to blocking struct */
+} pthread_mutex_t;
+
+typedef struct __pthread_mutexattr_t {
+       long valid;
+       __pthreadLongUint_t reserved[15];
+} pthread_mutexattr_t;
+
+typedef struct __pthread_cond_t {
+       unsigned int state;          /* EVENT, SLOW, REFCNT */
+       unsigned int valid;          /* Validation info */
+       __pthreadLongString_t name;   /* Name of condition variable */
+       unsigned int arg;            /* printf argument for name */
+       unsigned long sequence;       /* Condition variable seq # */
+       __pthreadLongAddr_t block;          /* Pointer to blocking struct */
+} pthread_cond_t ;
+
+typedef struct __pthread_condattr_t {
+       long valid;
+       __pthreadLongUint_t reserved[13];
+} pthread_condattr_t ;
+
+typedef struct __pthread_transp_t {
+       __pthreadLongAddr_t reserved1;      /* Reserved to posix_nt */
+       __pthreadLongAddr_t reserved2;      /* Reserved to posix_nt */
+       unsigned short size;           /* Size of data structure */
+       unsigned char reserved3[2];   /* Reserved to posix_nt */
+       __pthreadLongAddr_t reserved4;   /* Reserved to posix_nt */
+       __pthreadLongUint_t sequence;       /* Thread sequence number */
+       __pthreadLongUint_t reserved5[2];   /* Reserved to posix_nt */
+       __pthreadLongAddr_t per_kt_area;    /* Pointer to kernel context */
+       __pthreadLongAddr_t stack_base;     /* Current stack base */
+       __pthreadLongAddr_t stack_reserve; /* Current stack reserve zone */
+       __pthreadLongAddr_t stack_yellow;   /* Current stack yellow zone */
+       __pthreadLongAddr_t stack_guard;    /* Current stack guard zone */
+       __pthreadLongUint_t stack_size;     /* Size of stack */
+       __pthreadTsd_t tsd_values;     /* TSD array (indexed by key) */
+       unsigned long tsd_count;      /* Number of TSD cells */
+       __pthreadLongAddr_t reserved6;      /* Reserved to posix_nt */
+       __pthreadLongAddr_t reserved7;      /* Reserved to posix_nt */
+       unsigned int thread_flags;   /* Dynamic external state */
+} pthread_transp_t, *pthread_transp_p;
+
+typedef pthread_transp_p pthread_t;
+
+typedef struct __pthread_attr_t {
+       long valid;
+       __pthreadLongString_t name;
+       __pthreadLongUint_t arg;
+       __pthreadLongUint_t reserved[19];
+} pthread_attr_t ;
+
+typedef unsigned int pthread_key_t;
+
+typedef struct sched_param {
+       int sched_priority;
+} sched_param_t;
+        
+/*     Function Prototypes */
+
+int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
+                  void *(*start_routine)(void*), void *arg);
+int pthread_detach(pthread_t thread);
+int pthread_join(pthread_t thread, void **value_ptr);
+void pthread_exit(void *value_ptr);
+int pthread_attr_init(pthread_attr_t *attr);
+int pthread_attr_destroy(pthread_attr_t *attr);
+int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
+int pthread_attr_getstacksize(const pthread_attr_t *attr, 
+                             size_t *stacksize);
+int pthread_cond_init(pthread_cond_t *cond,
+                     const pthread_condattr_t *attr);
+int pthread_cond_destroy(pthread_cond_t *cond);
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
+int pthread_cond_timedwait(pthread_cond_t *cond, 
+                          pthread_mutex_t *mutex,
+                          const struct timespec *abstime);
+int pthread_cond_signal(pthread_cond_t *cond);
+int pthread_cond_broadcast(pthread_cond_t *cond);
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
+int pthread_key_delete(pthread_key_t key);
+int pthread_mutex_destroy(pthread_mutex_t *mutex);
+int pthread_mutex_init(pthread_mutex_t *mutex, 
+                      const pthread_mutexattr_t *attr);
+int pthread_mutex_lock(pthread_mutex_t *mutex);
+int pthread_mutex_trylock(pthread_mutex_t *mutex);
+int pthread_mutex_unlock(pthread_mutex_t *mutex);
+pthread_t pthread_self();
+int pthread_setspecific(pthread_key_t key, const void *value);
+void *pthread_getspecific(pthread_key_t key);
+int pthread_getschedparam(pthread_t thread, int *policy,
+                         struct sched_param *param);
+int pthread_setschedparam(pthread_t thread, int policy,
+                         const struct sched_param *param);
+int pthread_attr_setschedparam(pthread_attr_t *attr, 
+                              const struct sched_param *param);
+int pthread_attr_getschedparam(const pthread_attr_t *attr, 
+                              struct sched_param *param);
+
+int pthread_delay_np(const struct timespec *interval);
+int pthread_get_expiration_np(const struct timespec *delta,
+                             struct timespec *abstime);
+
+# define SCHED_FIFO 1
+# define SCHED_RR 2
+# define SCHED_OTHER 3
+
+int sched_yield();
+int sched_get_priority_max(int policy);
+int sched_get_priority_min(int policy);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //      PTHREAD_NT_H_INCLUDED
diff --git a/omnithread/gnuradio/ot_solaris.h b/omnithread/gnuradio/ot_solaris.h
new file mode 100644 (file)
index 0000000..f4fea0b
--- /dev/null
@@ -0,0 +1,47 @@
+//                             Package : omnithread
+// omnithread/solaris.h                Created : 7/94 tjr
+//
+//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
+//
+//    This file is part of the omnithread library
+//
+//    The omnithread library is free software; you can redistribute it and/or
+//    modify it under the terms of the GNU Library General Public
+//    License as published by the Free Software Foundation; either
+//    version 2 of the License, or (at your option) any later version.
+//
+//    This library is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//    Library General Public License for more details.
+//
+//    You should have received a copy of the GNU Library General Public
+//    License along with this library; if not, write to the Free
+//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
+//    02110-1301, USA
+//
+// OMNI thread implementation classes for solaris threads.
+//
+
+#ifndef __omnithread_solaris_h_
+#define __omnithread_solaris_h_
+
+#include <thread.h>
+
+extern "C" void* omni_thread_wrapper(void* ptr);
+
+#define OMNI_MUTEX_IMPLEMENTATION                      \
+    mutex_t sol_mutex;
+
+#define OMNI_CONDITION_IMPLEMENTATION                  \
+    cond_t sol_cond;
+
+#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
+    sema_t sol_sem;
+
+#define OMNI_THREAD_IMPLEMENTATION                     \
+    thread_t sol_thread;                               \
+    static int sol_priority(priority_t);               \
+    friend void* omni_thread_wrapper(void* ptr);
+
+#endif
index 8759bb4ce47a7308c2efdb86298e249d26f06ca8..aa0465f41ed7af8d9a113035ec2ad5f92573651c 100644 (file)
@@ -31,7 +31,7 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <mach/cthreads.h>
-#include "omnithread.h"
+#include "gnuradio/omnithread.h"
 
 #define DB(x) // x
 // #include <iostream> or #include <iostream.h> if DB is on.
index 3853f010809292279de93a7919d18e6d88a5355a..2c97d621390ae5f18284084838a25fc60cb8e4d8 100644 (file)
@@ -33,7 +33,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <WinError.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <process.h>
 
 #define DB(x) // x 
index 8703245bffafa8ddbf96361b3cf25be3cc82db91..4920a68399a5246fc9a344fa2b02e065c8b206a7 100644 (file)
@@ -22,8 +22,8 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include <omni_time.h>
-#include <omnithread.h>
+#include <gnuradio/omni_time.h>
+#include <gnuradio/omnithread.h>
 #include <math.h>
 #include <assert.h>
 
diff --git a/omnithread/omni_time.h b/omnithread/omni_time.h
deleted file mode 100644 (file)
index bfb1516..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef INCLUDED_OMNI_TIME_H
-#define INCLUDED_OMNI_TIME_H
-
-struct omni_time {
-  long int d_secs;     // seconds.
-  long int d_nsecs;    // nanoseconds.  Always in [0, 1e9-1]
-
-  omni_time() : d_secs(0), d_nsecs(0) {}
-  omni_time(long secs, long nanosecs=0) : d_secs(secs), d_nsecs(nanosecs) {}
-
-  // N.B., this only makes sense for differences between times.
-  // Double doesn't have enough bits to precisely represent an absolute time.
-  omni_time(double secs);
-
-  // N.B. This only makes sense for differences between times.
-  // Double doesn't have enough bits to precisely represent an absolute time.
-  double double_time() const { return (double)d_secs + d_nsecs * 1e-9; }
-
-  /*!
-   * \brief Return an absolute time suitable for use with
-   * schedule_one_shot_timeout & schedule_periodic_timeout
-   *
-   * The return value is the current time plus the given relative offset.
-   */
-  static omni_time time(const omni_time &relative_offset = omni_time());
-};
-
-
-inline static bool
-operator<(const omni_time &x, const omni_time &y)
-{
-  return ((x.d_secs < y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs < y.d_nsecs));
-}
-
-inline static bool
-operator>(const omni_time &x, const omni_time &y)
-{
-  return ((x.d_secs > y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs > y.d_nsecs));
-}
-
-inline static bool
-operator>=(const omni_time &x, const omni_time &y)
-{
-  return ((x.d_secs > y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs >= y.d_nsecs));
-}
-
-inline static bool
-operator<=(const omni_time &x, const omni_time &y)
-{
-  return ((x.d_secs < y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs <= y.d_nsecs));
-}
-
-inline static bool
-operator==(const omni_time &x, const omni_time &y)
-{
-  return (x.d_secs == y.d_secs && x.d_nsecs == y.d_nsecs);
-}
-
-
-omni_time operator+(const omni_time &x, const omni_time &y);
-omni_time operator+(const omni_time &x, double y);
-omni_time operator-(const omni_time &x, const omni_time &y);
-omni_time operator-(const omni_time &x, double y);
-
-#endif /* INCLUDED_OMNI_TIME_H */
diff --git a/omnithread/omnithread.h b/omnithread/omnithread.h
deleted file mode 100644 (file)
index 26e42b0..0000000
+++ /dev/null
@@ -1,626 +0,0 @@
-// -*- Mode: C++; -*-
-//                             Package : omnithread
-// omnithread.h                        Created : 7/94 tjr
-//
-//    Copyright (C) 2006 Free Software Foundation, Inc.
-//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
-//
-//    This file is part of the omnithread library
-//
-//    The omnithread library is free software; you can redistribute it and/or
-//    modify it under the terms of the GNU Library General Public
-//    License as published by the Free Software Foundation; either
-//    version 2 of the License, or (at your option) any later version.
-//
-//    This library is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//    Library General Public License for more details.
-//
-//    You should have received a copy of the GNU Library General Public
-//    License along with this library; if not, write to the Free
-//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-//    02110-1301, USA
-//
-
-//
-// Interface to OMNI thread abstraction.
-//
-// This file declares classes for threads and synchronisation objects
-// (mutexes, condition variables and counting semaphores).
-//
-// Wherever a seemingly arbitrary choice has had to be made as to the interface
-// provided, the intention here has been to be as POSIX-like as possible.  This
-// is why there is no semaphore timed wait, for example.
-//
-
-#ifndef __omnithread_h_
-#define __omnithread_h_
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-class omni_mutex;
-class omni_condition;
-class omni_semaphore;
-class omni_thread;
-
-//
-// OMNI_THREAD_EXPOSE can be defined as public or protected to expose the
-// implementation class - this may be useful for debugging.  Hopefully this
-// won't change the underlying structure which the compiler generates so that
-// this can work without recompiling the library.
-//
-
-#ifndef OMNI_THREAD_EXPOSE
-#define OMNI_THREAD_EXPOSE private
-#endif
-
-//
-// Include implementation-specific header file.
-//
-// This must define 4 CPP macros of the form OMNI_x_IMPLEMENTATION for mutex,
-// condition variable, semaphore and thread.  Each should define any
-// implementation-specific members of the corresponding classes.
-//
-
-
-//
-// For now, we assume they've always got a Posix Threads implementation.
-// If not, it'll take some configure hacking to sort it out, along with
-// the relevant libraries to link with, etc.
-//
-
-#if !defined(OMNITHREAD_POSIX) && !defined(OMNITHREAD_NT) && defined HAVE_CONFIG_H
-// #include <config.h>      // No, No, No!  Never include <config.h> from a header
-#endif
-
-#if defined(OMNITHREAD_POSIX)
-#include <ot_posix.h>
-
-#elif defined(OMNITHREAD_NT)
-#include <ot_nt.h>
-
-#ifdef _MSC_VER
-
-// Using MSVC++ to compile. If compiling library as a DLL,
-// define _OMNITHREAD_DLL. If compiling as a statuc library, define
-// _WINSTATIC
-// If compiling an application that is to be statically linked to omnithread,
-// define _WINSTATIC (if the application is  to be dynamically linked, 
-// there is no need to define any of these macros).
-
-#if defined (_OMNITHREAD_DLL) && defined(_WINSTATIC)
-#error "Both _OMNITHREAD_DLL and _WINSTATIC are defined."
-#elif defined(_OMNITHREAD_DLL)
-#define _OMNITHREAD_NTDLL_ __declspec(dllexport)
-#elif !defined(_WINSTATIC)
-#define _OMNITHREAD_NTDLL_ __declspec(dllimport)
-#elif defined(_WINSTATIC)
-#define _OMNITHREAD_NTDLL_
-#endif
- // _OMNITHREAD_DLL && _WINSTATIC
-
-#else
-
-// Not using MSVC++ to compile
-#define _OMNITHREAD_NTDLL_
-
-#endif
- // _MSC_VER
-#elif defined(__vxWorks__)
-#include <ot_VxThread.h>
-
-#elif defined(__sunos__)
-#if __OSVERSION__ != 5
-// XXX Workaround for SUN C++ compiler (seen on 4.2) Template.DB code
-//     regeneration bug. See omniORB2/CORBA_sysdep.h for details.
-#if !defined(__SUNPRO_CC) || __OSVERSION__ != '5'
-#error "Only SunOS 5.x or later is supported."
-#endif
-#endif
-#ifdef UseSolarisThreads
-#include <ot_solaris.h>
-#else
-#include <ot_posix.h>
-#endif
-
-#elif defined(__rtems__)
-#include <ot_posix.h>
-#include <sched.h>
-
-#elif defined(__macos__)
-#include <ot_posix.h>
-#include <sched.h>
-
-#else
-#error "No implementation header file"
-#endif
-
-
-#if !defined(__WIN32__)
-#define _OMNITHREAD_NTDLL_
-#endif
-
-#if (!defined(OMNI_MUTEX_IMPLEMENTATION)        || \
-     !defined(OMNI_MUTEX_LOCK_IMPLEMENTATION)   || \
-     !defined(OMNI_MUTEX_TRYLOCK_IMPLEMENTATION)|| \
-     !defined(OMNI_MUTEX_UNLOCK_IMPLEMENTATION) || \
-     !defined(OMNI_CONDITION_IMPLEMENTATION)    || \
-     !defined(OMNI_SEMAPHORE_IMPLEMENTATION)    || \
-     !defined(OMNI_THREAD_IMPLEMENTATION))
-#error "Implementation header file incomplete"
-#endif
-
-
-//
-// This exception is thrown in the event of a fatal error.
-//
-
-class _OMNITHREAD_NTDLL_ omni_thread_fatal {
-public:
-    int error;
-    omni_thread_fatal(int e = 0) : error(e) {}
-};
-
-
-//
-// This exception is thrown when an operation is invoked with invalid
-// arguments.
-//
-
-class _OMNITHREAD_NTDLL_ omni_thread_invalid {};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Mutex
-//
-///////////////////////////////////////////////////////////////////////////
-
-class _OMNITHREAD_NTDLL_ omni_mutex {
-
-public:
-    omni_mutex(void);
-    ~omni_mutex(void);
-
-    inline void lock(void)    { OMNI_MUTEX_LOCK_IMPLEMENTATION   }
-    inline void unlock(void)  { OMNI_MUTEX_UNLOCK_IMPLEMENTATION }
-    inline int trylock(void)  { return OMNI_MUTEX_TRYLOCK_IMPLEMENTATION }
-       // if mutex is unlocked, lock it and return 1 (true).
-       // If it's already locked then return 0 (false).
-
-    inline void acquire(void) { lock(); }
-    inline void release(void) { unlock(); }
-       // the names lock and unlock are preferred over acquire and release
-       // since we are attempting to be as POSIX-like as possible.
-
-    friend class omni_condition;
-
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_mutex(const omni_mutex&);
-    omni_mutex& operator=(const omni_mutex&);
-
-OMNI_THREAD_EXPOSE:
-    OMNI_MUTEX_IMPLEMENTATION
-};
-
-//
-// As an alternative to:
-// {
-//   mutex.lock();
-//   .....
-//   mutex.unlock();
-// }
-//
-// you can use a single instance of the omni_mutex_lock class:
-//
-// {
-//   omni_mutex_lock l(mutex);
-//   ....
-// }
-//
-// This has the advantage that mutex.unlock() will be called automatically
-// when an exception is thrown.
-//
-
-class _OMNITHREAD_NTDLL_ omni_mutex_lock {
-    omni_mutex& mutex;
-public:
-    omni_mutex_lock(omni_mutex& m) : mutex(m) { mutex.lock(); }
-    ~omni_mutex_lock(void) { mutex.unlock(); }
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_mutex_lock(const omni_mutex_lock&);
-    omni_mutex_lock& operator=(const omni_mutex_lock&);
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Condition variable
-//
-///////////////////////////////////////////////////////////////////////////
-
-class _OMNITHREAD_NTDLL_ omni_condition {
-
-    omni_mutex* mutex;
-
-public:
-    omni_condition(omni_mutex* m);
-       // constructor must be given a pointer to an existing mutex. The
-       // condition variable is then linked to the mutex, so that there is an
-       // implicit unlock and lock around wait() and timed_wait().
-
-    ~omni_condition(void);
-
-    void wait(void);
-       // wait for the condition variable to be signalled.  The mutex is
-       // implicitly released before waiting and locked again after waking up.
-       // If wait() is called by multiple threads, a signal may wake up more
-       // than one thread.  See POSIX threads documentation for details.
-
-    int timedwait(unsigned long secs, unsigned long nanosecs = 0);
-       // timedwait() is given an absolute time to wait until.  To wait for a
-       // relative time from now, use omni_thread::get_time. See POSIX threads
-       // documentation for why absolute times are better than relative.
-       // Returns 1 (true) if successfully signalled, 0 (false) if time
-       // expired.
-
-    void signal(void);
-       // if one or more threads have called wait(), signal wakes up at least
-       // one of them, possibly more.  See POSIX threads documentation for
-       // details.
-
-    void broadcast(void);
-       // broadcast is like signal but wakes all threads which have called
-       // wait().
-
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_condition(const omni_condition&);
-    omni_condition& operator=(const omni_condition&);
-
-OMNI_THREAD_EXPOSE:
-    OMNI_CONDITION_IMPLEMENTATION
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Counting (or binary) semaphore
-//
-///////////////////////////////////////////////////////////////////////////
-
-class _OMNITHREAD_NTDLL_ omni_semaphore {
-
-public:
-    // if max_count == 1, you've got a binary semaphore.
-    omni_semaphore(unsigned int initial = 1, unsigned int max_count = 0x7fffffff);
-    ~omni_semaphore(void);
-
-    void wait(void);
-       // if semaphore value is > 0 then decrement it and carry on. If it's
-       // already 0 then block.
-
-    int trywait(void);
-       // if semaphore value is > 0 then decrement it and return 1 (true).
-       // If it's already 0 then return 0 (false).
-
-    void post(void);
-       // if any threads are blocked in wait(), wake one of them up. Otherwise
-       // increment the value of the semaphore.
-
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_semaphore(const omni_semaphore&);
-    omni_semaphore& operator=(const omni_semaphore&);
-
-OMNI_THREAD_EXPOSE:
-    OMNI_SEMAPHORE_IMPLEMENTATION
-};
-
-//
-// A helper class for semaphores, similar to omni_mutex_lock above.
-//
-
-class _OMNITHREAD_NTDLL_ omni_semaphore_lock {
-    omni_semaphore& sem;
-public:
-    omni_semaphore_lock(omni_semaphore& s) : sem(s) { sem.wait(); }
-    ~omni_semaphore_lock(void) { sem.post(); }
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_semaphore_lock(const omni_semaphore_lock&);
-    omni_semaphore_lock& operator=(const omni_semaphore_lock&);
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Thread
-//
-///////////////////////////////////////////////////////////////////////////
-
-class _OMNITHREAD_NTDLL_ omni_thread {
-
-public:
-
-    enum priority_t {
-       PRIORITY_LOW,
-       PRIORITY_NORMAL,
-       PRIORITY_HIGH
-    };
-
-    enum state_t {
-       STATE_NEW,              // thread object exists but thread hasn't
-                               // started yet.
-       STATE_RUNNING,          // thread is running.
-       STATE_TERMINATED        // thread has terminated but storage has not
-                               // been reclaimed (i.e. waiting to be joined).
-    };
-
-    //
-    // Constructors set up the thread object but the thread won't start until
-    // start() is called. The create method can be used to construct and start
-    // a thread in a single call.
-    //
-
-    omni_thread(void (*fn)(void*), void* arg = NULL,
-               priority_t pri = PRIORITY_NORMAL);
-    omni_thread(void* (*fn)(void*), void* arg = NULL,
-               priority_t pri = PRIORITY_NORMAL);
-       // these constructors create a thread which will run the given function
-       // when start() is called.  The thread will be detached if given a
-       // function with void return type, undetached if given a function
-       // returning void*. If a thread is detached, storage for the thread is
-       // reclaimed automatically on termination. Only an undetached thread
-       // can be joined.
-
-    void start(void);
-       // start() causes a thread created with one of the constructors to
-       // start executing the appropriate function.
-
-protected:
-
-    omni_thread(void* arg = NULL, priority_t pri = PRIORITY_NORMAL);
-       // this constructor is used in a derived class.  The thread will
-       // execute the run() or run_undetached() member functions depending on
-       // whether start() or start_undetached() is called respectively.
-
-public:
-
-    void start_undetached(void);
-       // can be used with the above constructor in a derived class to cause
-       // the thread to be undetached.  In this case the thread executes the
-       // run_undetached member function.
-
-protected:
-
-    virtual ~omni_thread(void);
-       // destructor cannot be called by user (except via a derived class).
-       // Use exit() or cancel() instead. This also means a thread object must
-       // be allocated with new - it cannot be statically or automatically
-       // allocated. The destructor of a class that inherits from omni_thread
-       // shouldn't be public either (otherwise the thread object can be
-       // destroyed while the underlying thread is still running).
-
-public:
-
-    void join(void**);
-       // join causes the calling thread to wait for another's completion,
-       // putting the return value in the variable of type void* whose address
-       // is given (unless passed a null pointer). Only undetached threads
-       // may be joined. Storage for the thread will be reclaimed.
-
-    void set_priority(priority_t);
-       // set the priority of the thread.
-
-    static omni_thread* create(void (*fn)(void*), void* arg = NULL,
-                              priority_t pri = PRIORITY_NORMAL);
-    static omni_thread* create(void* (*fn)(void*), void* arg = NULL,
-                              priority_t pri = PRIORITY_NORMAL);
-       // create spawns a new thread executing the given function with the
-       // given argument at the given priority. Returns a pointer to the
-       // thread object. It simply constructs a new thread object then calls
-       // start.
-
-    static void exit(void* return_value = NULL);
-       // causes the calling thread to terminate.
-
-    static omni_thread* self(void);
-       // returns the calling thread's omni_thread object.  If the
-       // calling thread is not the main thread and is not created
-       // using this library, returns 0. (But see create_dummy()
-       // below.)
-
-    static void yield(void);
-       // allows another thread to run.
-
-    static void sleep(unsigned long secs, unsigned long nanosecs = 0);
-       // sleeps for the given time.
-
-    static void get_time(unsigned long* abs_sec, unsigned long* abs_nsec,
-                        unsigned long rel_sec = 0, unsigned long rel_nsec=0);
-       // calculates an absolute time in seconds and nanoseconds, suitable for
-       // use in timed_waits on condition variables, which is the current time
-       // plus the given relative offset.
-
-
-    static void stacksize(unsigned long sz);
-    static unsigned long stacksize();
-        // Use this value as the stack size when spawning a new thread.
-        // The default value (0) means that the thread library default is
-        // to be used.
-
-
-    // Per-thread data
-    //
-    // These functions allow you to attach additional data to an
-    // omni_thread. First allocate a key for yourself with
-    // allocate_key(). Then you can store any object whose class is
-    // derived from value_t. Any values still stored in the
-    // omni_thread when the thread exits are deleted.
-    //
-    // These functions are NOT thread safe, so you should be very
-    // careful about setting/getting data in a different thread to the
-    // current thread.
-
-    typedef unsigned int key_t;
-    static key_t allocate_key();
-
-    class value_t {
-    public:
-      virtual ~value_t() {}
-    };
-
-    value_t* set_value(key_t k, value_t* v);
-        // Sets a value associated with the given key. The key must
-        // have been allocated with allocate_key(). If a value has
-        // already been set with the specified key, the old value_t
-        // object is deleted and replaced. Returns the value which was
-        // set, or zero if the key is invalid.
-
-    value_t* get_value(key_t k);
-        // Returns the value associated with the key. If the key is
-        // invalid, or there is no value for the key, returns zero.
-
-    value_t* remove_value(key_t k);
-        // Removes the value associated with the key and returns it.
-        // If the key is invalid, or there is no value for the key,
-        // returns zero.
-
-
-    // Dummy omni_thread
-    //
-    // Sometimes, an application finds itself with threads created
-    // outside of omnithread which must interact with omnithread
-    // features such as the per-thread data. In this situation,
-    // omni_thread::self() would normally return 0. These functions
-    // allow the application to create a suitable dummy omni_thread
-    // object.
-
-    static omni_thread* create_dummy(void);
-        // creates a dummy omni_thread for the calling thread. Future
-        // calls to self() will return the dummy omni_thread. Throws
-        // omni_thread_invalid if this thread already has an
-        // associated omni_thread (real or dummy).
-
-    static void release_dummy();
-        // release the dummy omni_thread for this thread. This
-        // function MUST be called before the thread exits. Throws
-        // omni_thread_invalid if the calling thread does not have a
-        // dummy omni_thread.
-
-    // class ensure_self should be created on the stack. If created in
-    // a thread without an associated omni_thread, it creates a dummy
-    // thread which is released when the ensure_self object is deleted.
-
-    class ensure_self {
-    public:
-      inline ensure_self() : _dummy(0)
-      {
-       _self = omni_thread::self();
-       if (!_self) {
-         _dummy = 1;
-         _self  = omni_thread::create_dummy();
-       }
-      }
-      inline ~ensure_self()
-      {
-       if (_dummy)
-         omni_thread::release_dummy();
-      }
-      inline omni_thread* self() { return _self; }
-    private:
-      omni_thread* _self;
-      int          _dummy;
-    };
-
-
-private:
-
-    virtual void run(void* /*arg*/) {}
-    virtual void* run_undetached(void* /*arg*/) { return NULL; }
-       // can be overridden in a derived class.  When constructed using the
-       // the constructor omni_thread(void*, priority_t), these functions are
-       // called by start() and start_undetached() respectively.
-
-    void common_constructor(void* arg, priority_t pri, int det);
-       // implements the common parts of the constructors.
-
-    omni_mutex mutex;
-       // used to protect any members which can change after construction,
-       // i.e. the following 2 members.
-
-    state_t _state;
-    priority_t _priority;
-
-    static omni_mutex* next_id_mutex;
-    static int next_id;
-    int _id;
-
-    void (*fn_void)(void*);
-    void* (*fn_ret)(void*);
-    void* thread_arg;
-    int detached;
-    int _dummy;
-    value_t**     _values;
-    unsigned long _value_alloc;
-
-    omni_thread(const omni_thread&);
-    omni_thread& operator=(const omni_thread&);
-    // Not implemented
-
-public:
-
-    priority_t priority(void) {
-
-       // return this thread's priority.
-
-       omni_mutex_lock l(mutex);
-       return _priority;
-    }
-
-    state_t state(void) {
-
-       // return thread state (invalid, new, running or terminated).
-
-       omni_mutex_lock l(mutex);
-       return _state;
-    }
-
-    int id(void) { return _id; }
-       // return unique thread id within the current process.
-
-
-    // This class plus the instance of it declared below allows us to execute
-    // some initialisation code before main() is called.
-
-    class _OMNITHREAD_NTDLL_ init_t {
-    public:
-       init_t(void);
-        ~init_t(void);
-    };
-
-    friend class init_t;
-    friend class omni_thread_dummy;
-
-OMNI_THREAD_EXPOSE:
-    OMNI_THREAD_IMPLEMENTATION
-};
-
-#ifndef __rtems__
-static omni_thread::init_t omni_thread_init;
-#else
-// RTEMS calls global Ctor/Dtor in a context that is not
-// a posix thread. Calls to functions to pthread_self() in
-// that context returns NULL. 
-// So, for RTEMS we will make the thread initialization at the
-// beginning of the Init task that has a posix context.
-#endif
-
-#endif
diff --git a/omnithread/ot_VxThread.h b/omnithread/ot_VxThread.h
deleted file mode 100644 (file)
index e96c036..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef __VXTHREAD_H__
-#define __VXTHREAD_H__
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Project:     omniORB
-%% Filename:    $Filename$
-%% Author:      Guillaume/Bill ARRECKX
-%%              Copyright Wavetek Wandel & Goltermann, Plymouth.
-%% Description: OMNI thread implementation classes for VxWorks threads
-%% Notes:
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% $Log$
-%% Revision 1.1  2004/04/10 18:00:52  eb
-%% Initial revision
-%%
-%% Revision 1.1.1.1  2004/03/01 00:20:27  eb
-%% initial checkin
-%%
-%% Revision 1.1  2003/05/25 05:29:04  eb
-%% see ChangeLog
-%%
-%% Revision 1.1.2.1  2003/02/17 02:03:07  dgrisby
-%% vxWorks port. (Thanks Michael Sturm / Acterna Eningen GmbH).
-%%
-%% Revision 1.1.1.1  2002/11/19 14:55:21  sokcevti
-%% OmniOrb4.0.0 VxWorks port
-%%
-%% Revision 1.2  2002/06/14 12:45:50  engeln
-%% unnecessary members in condition removed.
-%% ---
-%%
-%% Revision 1.1.1.1  2002/04/02 10:08:49  sokcevti
-%% omniORB4 initial realease
-%%
-%% Revision 1.1  2001/03/23 16:50:23  hartmut
-%% Initial Version 2.8
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-*/
-
-
-///////////////////////////////////////////////////////////////////////////
-// Includes
-///////////////////////////////////////////////////////////////////////////
-#include <vxWorks.h>
-#include <semLib.h>
-#include <taskLib.h>
-
-
-///////////////////////////////////////////////////////////////////////////
-// Externs prototypes
-///////////////////////////////////////////////////////////////////////////
-extern "C" void omni_thread_wrapper(void* ptr);
-
-
-///////////////////////////////////////////////////////////////////////////
-// Exported macros
-// Note: These are added as private members in each class implementation.
-///////////////////////////////////////////////////////////////////////////
-#define OMNI_MUTEX_IMPLEMENTATION \
-   SEM_ID mutexID;     \
-   bool m_bConstructed;
-
-#define OMNI_CONDITION_IMPLEMENTATION \
-   long waiters_; \
-   SEM_ID waiters_lock_; \
-   SEM_ID sema_;
-
-#define OMNI_SEMAPHORE_IMPLEMENTATION \
-   SEM_ID semID;
-
-#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
-       if(semTake(mutexID, WAIT_FOREVER) != OK)        \
-       {       \
-               throw omni_thread_fatal(errno); \
-       }
-
-#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
-       if(semGive(mutexID) != OK)      \
-       {       \
-               throw omni_thread_fatal(errno); \
-       }
-
-#define OMNI_THREAD_IMPLEMENTATION \
-   friend void omni_thread_wrapper(void* ptr); \
-   static int vxworks_priority(priority_t); \
-   omni_condition *running_cond; \
-   void* return_val; \
-   int tid; \
-   public: \
-   static void attach(void); \
-   static void detach(void); \
-   static void show(void);
-
-
-///////////////////////////////////////////////////////////////////////////
-// Porting macros
-///////////////////////////////////////////////////////////////////////////
-// This is a wrapper function for the 'main' function which does not exists
-//  as such in VxWorks. The wrapper creates a launch function instead,
-//  which spawns the application wrapped in a omni_thread.
-// Argc will always be null.
-///////////////////////////////////////////////////////////////////////////
-#define main( discarded_argc, discarded_argv ) \
-        omni_discard_retval() \
-          { \
-          throw; \
-          } \
-        int omni_main( int argc, char **argv ); \
-        void launch( ) \
-          { \
-          omni_thread* th = new omni_thread( (void(*)(void*))omni_main );\
-          th->start();\
-          }\
-        int omni_main( int argc, char **argv )
-
-
-#endif // ndef __VXTHREAD_H__
diff --git a/omnithread/ot_mach.h b/omnithread/ot_mach.h
deleted file mode 100644 (file)
index 7636192..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//                             Package : omnithread
-// omnithread/posix.h          Created : 7/97 lars immisch lars@ibp.de
-//
-//    Copyright (C) 1994,1995,1996, 1997 Immisch, becker & Partner
-//
-//    This file is part of the omnithread library
-//
-//    The omnithread library is free software; you can redistribute it and/or
-//    modify it under the terms of the GNU Library General Public
-//    License as published by the Free Software Foundation; either
-//    version 2 of the License, or (at your option) any later version.
-//
-//    This library is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//    Library General Public License for more details.
-//
-//    You should have received a copy of the GNU Library General Public
-//    License along with this library; if not, write to the Free
-//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-//    02110-1301, USA
-//
-//
-// OMNI thread implementation classes for posix threads
-//
-
-#ifndef __omnithread_mach_h_
-#define __omnithread_mach_h_
-
-#include <mach/cthreads.h>
-
-extern "C" void* omni_thread_wrapper(void* ptr);
-
-#define OMNI_MUTEX_IMPLEMENTATION                      \
-    struct mutex mach_mutex;
-
-#define OMNI_CONDITION_IMPLEMENTATION                  \
-    struct condition mach_cond;
-
-#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
-    omni_mutex m;                                      \
-    omni_condition c;                                  \
-    int value;
-
-
-#define OMNI_THREAD_IMPLEMENTATION                     \
-    cthread_t mach_thread;                             \
-    static int mach_priority(priority_t);              \
-    friend void* omni_thread_wrapper(void* ptr);
-
-#endif
diff --git a/omnithread/ot_nt.h b/omnithread/ot_nt.h
deleted file mode 100644 (file)
index 551ccf2..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-//                             Package : omnithread
-// omnithread/nt.h             Created : 6/95 tjr
-//
-//    Copyright (C) 1995, 1996, 1997 Olivetti & Oracle Research Laboratory
-//
-//    This file is part of the omnithread library
-//
-//    The omnithread library is free software; you can redistribute it and/or
-//    modify it under the terms of the GNU Library General Public
-//    License as published by the Free Software Foundation; either
-//    version 2 of the License, or (at your option) any later version.
-//
-//    This library is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//    Library General Public License for more details.
-//
-//    You should have received a copy of the GNU Library General Public
-//    License along with this library; if not, write to the Free
-//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-//    02110-1301, USA
-//
-//
-// OMNI thread implementation classes for NT threads.
-//
-
-#ifndef __omnithread_nt_h_
-#define __omnithread_nt_h_
-
-#ifndef WIN32_LEAN_AND_MEAN
-#  define WIN32_LEAN_AND_MEAN
-#  define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#  undef WIN32_LEAN_AND_MEAN
-#  undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#endif
-
-
-#ifndef __BCPLUSPLUS__
-#define OMNI_THREAD_WRAPPER \
-    unsigned __stdcall omni_thread_wrapper(LPVOID ptr);
-#else
-#define OMNI_THREAD_WRAPPER \
-    void _USERENTRY omni_thread_wrapper(void *ptr);
-#endif
-
-extern "C" OMNI_THREAD_WRAPPER;
-
-#define OMNI_MUTEX_IMPLEMENTATION                      \
-    CRITICAL_SECTION crit;
-
-#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
-    EnterCriticalSection(&crit);
-
-#define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION               \
-    TryEnterCriticalSection(&crit);
-
-#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
-    LeaveCriticalSection(&crit);
-
-#define OMNI_CONDITION_IMPLEMENTATION                  \
-    CRITICAL_SECTION crit;                             \
-    omni_thread* waiting_head;                         \
-    omni_thread* waiting_tail;
-
-#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
-    HANDLE nt_sem;
-
-#define OMNI_THREAD_IMPLEMENTATION                     \
-    HANDLE handle;                                     \
-    DWORD nt_id;                                       \
-    void* return_val;                                  \
-    HANDLE cond_semaphore;                             \
-    omni_thread* cond_next;                            \
-    omni_thread* cond_prev;                            \
-    BOOL cond_waiting;                                 \
-    static int nt_priority(priority_t);                        \
-    friend class omni_condition;                       \
-    friend OMNI_THREAD_WRAPPER;
-
-#endif
diff --git a/omnithread/ot_posix.h b/omnithread/ot_posix.h
deleted file mode 100644 (file)
index 666ccc0..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-//                             Package : omnithread
-// omnithread/posix.h          Created : 7/94 tjr
-//
-//    Copyright (C) 2006 Free Software Foundation, Inc.
-//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
-//
-//    This file is part of the omnithread library
-//
-//    The omnithread library is free software; you can redistribute it and/or
-//    modify it under the terms of the GNU Library General Public
-//    License as published by the Free Software Foundation; either
-//    version 2 of the License, or (at your option) any later version.
-//
-//    This library is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//    Library General Public License for more details.
-//
-//    You should have received a copy of the GNU Library General Public
-//    License along with this library; if not, write to the Free
-//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-//    02110-1301, USA
-//
-//
-// OMNI thread implementation classes for posix threads
-//
-
-#ifndef __omnithread_posix_h_
-#define __omnithread_posix_h_
-
-#if defined(__alpha__) && defined(__osf1__) || defined(__hpux__)
-// stop unnecessary definitions of TRY, etc on OSF
-#ifndef EXC_HANDLING
-#define EXC_HANDLING
-#endif
-#endif
-
-#ifndef __POSIX_NT__
-#  include <pthread.h>
-#else
-#  ifndef WIN32_LEAN_AND_MEAN
-#    define WIN32_LEAN_AND_MEAN
-#    define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#  endif
-#  include <windows.h>
-#  include "pthread_nt.h"
-#  ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#    undef WIN32_LEAN_AND_MEAN
-#    undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#  endif
-#endif
-
-extern "C" void* omni_thread_wrapper(void* ptr);
-
-#define OMNI_MUTEX_IMPLEMENTATION                      \
-    pthread_mutex_t posix_mutex;
-
-#define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
-    pthread_mutex_lock(&posix_mutex);
-
-#define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION               \
-    (pthread_mutex_trylock(&posix_mutex)==0);
-
-#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
-    pthread_mutex_unlock(&posix_mutex);
-
-#define OMNI_CONDITION_IMPLEMENTATION                  \
-    pthread_cond_t posix_cond;
-
-#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
-    omni_mutex m;                                      \
-    omni_condition c;                                  \
-    int value;                                         \
-    int max_count;
-
-#define OMNI_THREAD_IMPLEMENTATION                     \
-    pthread_t posix_thread;                            \
-    static int posix_priority(priority_t);             \
-    friend void* omni_thread_wrapper(void* ptr);
-
-#endif
diff --git a/omnithread/ot_pthread_nt.h b/omnithread/ot_pthread_nt.h
deleted file mode 100644 (file)
index 324b525..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/*                             Package : omnithread
-   omnithread/pthread_nt.h     Created : Steven Brenneis <brennes1@rjrt.com>
-  
-      Copyright (C) 1998 Steven Brennes
-  
-      This file is part of the omnithread library
-  
-      The omnithread library is free software; you can redistribute it and/or
-      modify it under the terms of the GNU Library General Public
-      License as published by the Free Software Foundation; either
-      version 2 of the License, or (at your option) any later version.
-  
-      This library is distributed in the hope that it will be useful,
-      but WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      Library General Public License for more details.
-  
-      You should have received a copy of the GNU Library General Public
-      License along with this library; if not, write to the Free
-      Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-      02110-1301, USA
-  
-      Posix Threads implementation for Windows NT, version 4.0
-*/
-
-#ifndef PTHREAD_NT_H_INCLUDED
-#define PTHREAD_NT_H_INCLUDED
-
-#include <errno.h>
-
-#ifndef ETIMEDOUT
-//     May have to be changed if NT starts supporting more errno values
-#define ETIMEDOUT 60
-#endif
-
-#undef PthreadDraftVersion
-#define PthreadDraftVersion 10
-
-#define NoNanoSleep
-
-#define PthreadSupportThreadPriority
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _TIMERS_T_
-#define _TIMERS_T_
-       typedef struct timespec {
-               unsigned long tv_sec;
-               long tv_nsec;
-       } timespec_t;
-#endif
-
-typedef char* __pthreadLongString_t;
-typedef void* __pthreadLongAddr_t;
-typedef __pthreadLongAddr_t* __pthreadLongAddr_p;
-typedef long __pthreadLongInt_t;
-typedef unsigned long __pthreadLongUint_t;
-typedef __pthreadLongAddr_p __pthreadTsd_t;
-
-typedef struct __pthread_mutex_t {
-       unsigned int lock;           /* LOCK, SLOW, TYPE, RECURSIVE  */
-       unsigned int valid;          /* Validation info */
-       __pthreadLongString_t name;   /* Name of mutex */
-       unsigned int arg;            /* printf argument for  name */
-       unsigned int depth;          /* Recursive lock depth */
-       unsigned long sequence;       /* Mutex sequence number */
-       unsigned long owner;          /* Current owner (if known */
-       __pthreadLongAddr_t block;          /* Pointer to blocking struct */
-} pthread_mutex_t;
-
-typedef struct __pthread_mutexattr_t {
-       long valid;
-       __pthreadLongUint_t reserved[15];
-} pthread_mutexattr_t;
-
-typedef struct __pthread_cond_t {
-       unsigned int state;          /* EVENT, SLOW, REFCNT */
-       unsigned int valid;          /* Validation info */
-       __pthreadLongString_t name;   /* Name of condition variable */
-       unsigned int arg;            /* printf argument for name */
-       unsigned long sequence;       /* Condition variable seq # */
-       __pthreadLongAddr_t block;          /* Pointer to blocking struct */
-} pthread_cond_t ;
-
-typedef struct __pthread_condattr_t {
-       long valid;
-       __pthreadLongUint_t reserved[13];
-} pthread_condattr_t ;
-
-typedef struct __pthread_transp_t {
-       __pthreadLongAddr_t reserved1;      /* Reserved to posix_nt */
-       __pthreadLongAddr_t reserved2;      /* Reserved to posix_nt */
-       unsigned short size;           /* Size of data structure */
-       unsigned char reserved3[2];   /* Reserved to posix_nt */
-       __pthreadLongAddr_t reserved4;   /* Reserved to posix_nt */
-       __pthreadLongUint_t sequence;       /* Thread sequence number */
-       __pthreadLongUint_t reserved5[2];   /* Reserved to posix_nt */
-       __pthreadLongAddr_t per_kt_area;    /* Pointer to kernel context */
-       __pthreadLongAddr_t stack_base;     /* Current stack base */
-       __pthreadLongAddr_t stack_reserve; /* Current stack reserve zone */
-       __pthreadLongAddr_t stack_yellow;   /* Current stack yellow zone */
-       __pthreadLongAddr_t stack_guard;    /* Current stack guard zone */
-       __pthreadLongUint_t stack_size;     /* Size of stack */
-       __pthreadTsd_t tsd_values;     /* TSD array (indexed by key) */
-       unsigned long tsd_count;      /* Number of TSD cells */
-       __pthreadLongAddr_t reserved6;      /* Reserved to posix_nt */
-       __pthreadLongAddr_t reserved7;      /* Reserved to posix_nt */
-       unsigned int thread_flags;   /* Dynamic external state */
-} pthread_transp_t, *pthread_transp_p;
-
-typedef pthread_transp_p pthread_t;
-
-typedef struct __pthread_attr_t {
-       long valid;
-       __pthreadLongString_t name;
-       __pthreadLongUint_t arg;
-       __pthreadLongUint_t reserved[19];
-} pthread_attr_t ;
-
-typedef unsigned int pthread_key_t;
-
-typedef struct sched_param {
-       int sched_priority;
-} sched_param_t;
-        
-/*     Function Prototypes */
-
-int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
-                  void *(*start_routine)(void*), void *arg);
-int pthread_detach(pthread_t thread);
-int pthread_join(pthread_t thread, void **value_ptr);
-void pthread_exit(void *value_ptr);
-int pthread_attr_init(pthread_attr_t *attr);
-int pthread_attr_destroy(pthread_attr_t *attr);
-int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
-int pthread_attr_getstacksize(const pthread_attr_t *attr, 
-                             size_t *stacksize);
-int pthread_cond_init(pthread_cond_t *cond,
-                     const pthread_condattr_t *attr);
-int pthread_cond_destroy(pthread_cond_t *cond);
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-int pthread_cond_timedwait(pthread_cond_t *cond, 
-                          pthread_mutex_t *mutex,
-                          const struct timespec *abstime);
-int pthread_cond_signal(pthread_cond_t *cond);
-int pthread_cond_broadcast(pthread_cond_t *cond);
-int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
-int pthread_key_delete(pthread_key_t key);
-int pthread_mutex_destroy(pthread_mutex_t *mutex);
-int pthread_mutex_init(pthread_mutex_t *mutex, 
-                      const pthread_mutexattr_t *attr);
-int pthread_mutex_lock(pthread_mutex_t *mutex);
-int pthread_mutex_trylock(pthread_mutex_t *mutex);
-int pthread_mutex_unlock(pthread_mutex_t *mutex);
-pthread_t pthread_self();
-int pthread_setspecific(pthread_key_t key, const void *value);
-void *pthread_getspecific(pthread_key_t key);
-int pthread_getschedparam(pthread_t thread, int *policy,
-                         struct sched_param *param);
-int pthread_setschedparam(pthread_t thread, int policy,
-                         const struct sched_param *param);
-int pthread_attr_setschedparam(pthread_attr_t *attr, 
-                              const struct sched_param *param);
-int pthread_attr_getschedparam(const pthread_attr_t *attr, 
-                              struct sched_param *param);
-
-int pthread_delay_np(const struct timespec *interval);
-int pthread_get_expiration_np(const struct timespec *delta,
-                             struct timespec *abstime);
-
-# define SCHED_FIFO 1
-# define SCHED_RR 2
-# define SCHED_OTHER 3
-
-int sched_yield();
-int sched_get_priority_max(int policy);
-int sched_get_priority_min(int policy);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //      PTHREAD_NT_H_INCLUDED
diff --git a/omnithread/ot_solaris.h b/omnithread/ot_solaris.h
deleted file mode 100644 (file)
index f4fea0b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//                             Package : omnithread
-// omnithread/solaris.h                Created : 7/94 tjr
-//
-//    Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
-//
-//    This file is part of the omnithread library
-//
-//    The omnithread library is free software; you can redistribute it and/or
-//    modify it under the terms of the GNU Library General Public
-//    License as published by the Free Software Foundation; either
-//    version 2 of the License, or (at your option) any later version.
-//
-//    This library is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//    Library General Public License for more details.
-//
-//    You should have received a copy of the GNU Library General Public
-//    License along with this library; if not, write to the Free
-//    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
-//    02110-1301, USA
-//
-// OMNI thread implementation classes for solaris threads.
-//
-
-#ifndef __omnithread_solaris_h_
-#define __omnithread_solaris_h_
-
-#include <thread.h>
-
-extern "C" void* omni_thread_wrapper(void* ptr);
-
-#define OMNI_MUTEX_IMPLEMENTATION                      \
-    mutex_t sol_mutex;
-
-#define OMNI_CONDITION_IMPLEMENTATION                  \
-    cond_t sol_cond;
-
-#define OMNI_SEMAPHORE_IMPLEMENTATION                  \
-    sema_t sol_sem;
-
-#define OMNI_THREAD_IMPLEMENTATION                     \
-    thread_t sol_thread;                               \
-    static int sol_priority(priority_t);               \
-    friend void* omni_thread_wrapper(void* ptr);
-
-#endif
index 7325166c6ce8da207331db6941bc4b77bbcbe2d5..5574a8a0dd4206f1f1aad326d7d1b73b1c0a955e 100644 (file)
@@ -49,7 +49,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <time.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 
 #if (PthreadDraftVersion == 0)
 #error "PthreadDraftVersion not defined.  If not sure, define it to 10"
index b0139d29df816b9d8bca4891f8d575639de07a19..eedaaa99f60ae4dc15d706f40f90a1ba91657078 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <stdlib.h>
 #include <errno.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 
 #define DB(x) // x 
 // #include <iostream> or #include <iostream.h> if DB is on.
index 25634ce9389211974e7bb2a010b686ebceed1ea9..aaff6cdb202c8a2f8cbbab626b6231202a97d2aa 100644 (file)
@@ -56,7 +56,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <time.h>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <sysLib.h>
 
 #include <assert.h>            // assert
index 42276a14f0b1bc22e2667d7eeeb5aae9a13ba5bb..dd63d44a6c3ec283260a303e36fba5ce3dc04059 100644 (file)
@@ -22,7 +22,7 @@
 #define INCLUDED_PMT_POOL_H
 
 #include <cstddef>
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <vector>
 
 /*!
index b2ec657510043b2fa1b7404ac8b5921a2b0644e5..322f557b60608265cf8ef8b0efb580d55c248cc2 100644 (file)
@@ -29,7 +29,7 @@
 
 #define __macos__
 #ifdef _USE_OMNI_THREADS_
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #else
 #include <pthread.h>
 #endif
index 97d969fa6a2a39a3b02b6f574b56f064a28aab5a..4b8597c6003a15983d0c12fe3e28e18e68978ca5 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 
-#include <omni_time.h>
+#include <gnuradio/omni_time.h>
 #include "control.h"
 #include <iostream>
 
index 33f73fa943604f11f7f3d147d8c585ba740005b1..0e8fcfe57b7c0d1f4905e06fbf78a962990a105f 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_CONTROL_H
 #define INCLUDED_CONTROL_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <usrp2_eth_packet.h>
 
 namespace usrp2 {
index 2f4346ca615a10cb9c223b9b02675459a6a405a4..19ae9ae97221ff756e9f9bdc68a718631559c772 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef INCLUDED_RING_H
 #define INCLUDED_RING_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <stddef.h>
 #include <vector>
 #include <boost/shared_ptr.hpp>
index c7f9e1aaffcaad117d082031d5ec6d4ec54db3d4..12723e947129502402db33a11db4c8f6dc587702 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef INCLUDED_USRP2_THREAD_H
 #define INCLUDED_USRP2_THREAD_H
 
-#include <omnithread.h>
+#include <gnuradio/omnithread.h>
 #include <usrp2_impl.h>
 
 namespace usrp2 {