[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11465 - in gnuradio/branches/developers/jcorgan/omni:
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r11465 - in gnuradio/branches/developers/jcorgan/omni: config gnuradio-core/src/lib/io gnuradio-core/src/lib/runtime gr-audio-portaudio/src gruel/src/include/gruel |
Date: |
Mon, 20 Jul 2009 21:58:37 -0600 (MDT) |
Author: jcorgan
Date: 2009-07-20 21:58:36 -0600 (Mon, 20 Jul 2009)
New Revision: 11465
Added:
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread.h
Modified:
gnuradio/branches/developers/jcorgan/omni/config/grc_gnuradio_core.m4
gnuradio/branches/developers/jcorgan/omni/config/grc_gr_audio_portaudio.m4
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_block_executor.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.i
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.cc
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.h
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.cc
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.h
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/Makefile.am
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_body_wrapper.h
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_group.h
Log:
Checkpoint. gnuradio-core no longer uses omnithreads. gri_logger commented
out for now in core and in gr-audio-portaudio.
Modified: gnuradio/branches/developers/jcorgan/omni/config/grc_gnuradio_core.m4
===================================================================
--- gnuradio/branches/developers/jcorgan/omni/config/grc_gnuradio_core.m4
2009-07-20 18:47:24 UTC (rev 11464)
+++ gnuradio/branches/developers/jcorgan/omni/config/grc_gnuradio_core.m4
2009-07-21 03:58:36 UTC (rev 11465)
@@ -28,9 +28,8 @@
gnuradio_core_PYDIRPATH=$pythondir
])
- dnl Don't do gnuradio-core if gruel or omnithread skipped
+ dnl Don't do gnuradio-core if gruel skipped
GRC_CHECK_DEPENDENCY(gnuradio-core, gruel)
- GRC_CHECK_DEPENDENCY(gnuradio-core, omnithread)
dnl If execution gets to here, $passed will be:
dnl with : if the --with code didn't error out
Modified:
gnuradio/branches/developers/jcorgan/omni/config/grc_gr_audio_portaudio.m4
===================================================================
--- gnuradio/branches/developers/jcorgan/omni/config/grc_gr_audio_portaudio.m4
2009-07-20 18:47:24 UTC (rev 11464)
+++ gnuradio/branches/developers/jcorgan/omni/config/grc_gr_audio_portaudio.m4
2009-07-21 03:58:36 UTC (rev 11465)
@@ -22,6 +22,7 @@
dnl Don't do gr-audio-portaudio if gnuradio-core skipped
GRC_CHECK_DEPENDENCY(gr-audio-portaudio, gnuradio-core)
+ GRC_CHECK_DEPENDENCY(gr-audio-portaudio, omnithread)
dnl If execution gets to here, $passed will be:
dnl with : if the --with code didn't error out
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <stdexcept>
#include <stdio.h>
+#include <gruel/thread.h>
// win32 (mingw/msvc) specific
#ifdef HAVE_IO_H
@@ -68,7 +69,7 @@
bool
gr_file_sink_base::open(const char *filename)
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this
function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
// we use the open system call to get access to the O_LARGEFILE flag.
int fd;
@@ -96,7 +97,7 @@
void
gr_file_sink_base::close()
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this
function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
if (d_new_fp){
fclose(d_new_fp);
@@ -109,7 +110,7 @@
gr_file_sink_base::do_update()
{
if (d_updated){
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this block
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
if (d_fp)
fclose(d_fp);
d_fp = d_new_fp; // install new file pointer
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_file_sink_base.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,7 +23,7 @@
#ifndef INCLUDED_GR_FILE_SINK_BASE_H
#define INCLUDED_GR_FILE_SINK_BASE_H
-#include <gnuradio/omnithread.h>
+#include <boost/thread.hpp>
#include <cstdio>
/*!
@@ -36,7 +36,7 @@
FILE *d_new_fp; // new FILE pointer
bool d_updated; // is there a new FILE pointer?
bool d_is_binary;
- omni_mutex d_mutex;
+ boost::mutex d_mutex;
protected:
gr_file_sink_base(const char *filename, bool is_binary);
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -36,6 +36,8 @@
typedef char* optval_t;
#endif
+#include <gruel/thread.h>
+
#define SNK_VERBOSE 0
gr_udp_sink::gr_udp_sink (size_t itemsize,
@@ -110,7 +112,7 @@
bool
gr_udp_sink::open()
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
// create socket
if((d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
@@ -153,7 +155,7 @@
void
gr_udp_sink::close()
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
if (d_socket){
shutdown(d_socket, SHUT_RDWR);
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_sink.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,7 @@
#define INCLUDED_GR_UDP_SINK_H
#include <gr_sync_block.h>
-#include <gnuradio/omnithread.h>
+#include <boost/thread.hpp>
#if defined(HAVE_SOCKET)
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -36,6 +36,8 @@
#include <netinet/in.h>
#endif
+#include <gruel/thread.h>
+
class gr_udp_sink;
typedef boost::shared_ptr<gr_udp_sink> gr_udp_sink_sptr;
@@ -69,7 +71,7 @@
private:
size_t d_itemsize;
bool d_updated;
- omni_mutex d_mutex;
+ gruel::mutex d_mutex;
int d_payload_size; // maximum transmission unit (packet
length)
int d_socket; // handle to socket
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -90,7 +90,7 @@
bool
gr_udp_source::open()
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
// create socket
d_socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(d_socket == -1) {
@@ -137,7 +137,7 @@
void
gr_udp_source::close()
{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
function
if (d_socket){
shutdown(d_socket, SHUT_RDWR);
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_udp_source.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,6 @@
#define INCLUDED_GR_UDP_SOURCE_H
#include <gr_sync_block.h>
-#include <gnuradio/omnithread.h>
#if defined(HAVE_SOCKET)
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -36,6 +35,8 @@
#include <netinet/in.h>
#endif
+#include <gruel/thread.h>
+
class gr_udp_source;
typedef boost::shared_ptr<gr_udp_source> gr_udp_source_sptr;
@@ -63,7 +64,7 @@
private:
size_t d_itemsize;
bool d_updated;
- omni_mutex d_mutex;
+ gruel::mutex d_mutex;
int d_payload_size; // maximum transmission unit (packet length)
int d_socket; // handle to socket
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2007,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -32,6 +32,7 @@
#include <cstring>
#include <cmath>
#include <fcntl.h>
+#include <gruel/thread.h>
// win32 (mingw/msvc) specific
#ifdef HAVE_IO_H
@@ -103,7 +104,7 @@
bool
gr_wavfile_sink::open(const char* filename)
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock guard(d_mutex);
// we use the open system call to get access to the O_LARGEFILE flag.
int fd;
@@ -141,7 +142,7 @@
void
gr_wavfile_sink::close()
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock guard(d_mutex);
if (!d_fp)
return;
@@ -230,7 +231,7 @@
void
gr_wavfile_sink::set_bits_per_sample(int bits_per_sample)
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock guard(d_mutex);
if (bits_per_sample == 8 || bits_per_sample == 16) {
d_bytes_per_sample_new = bits_per_sample / 8;
}
@@ -240,7 +241,7 @@
void
gr_wavfile_sink::set_sample_rate(unsigned int sample_rate)
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock guard(d_mutex);
d_sample_rate = sample_rate;
}
@@ -252,7 +253,7 @@
return;
}
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this block
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this
block
if (d_fp) {
close_wav();
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gr_wavfile_sink.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,7 +25,7 @@
#include <gr_sync_block.h>
#include <gr_file_sink_base.h>
-#include <gnuradio/omnithread.h>
+#include <boost/thread.hpp>
class gr_wavfile_sink;
typedef boost::shared_ptr<gr_wavfile_sink> gr_wavfile_sink_sptr;
@@ -76,7 +76,7 @@
FILE *d_fp;
FILE *d_new_fp;
bool d_updated;
- omni_mutex d_mutex;
+ boost::mutex d_mutex;
/*!
* \brief Convert a sample value within [-1;+1] to a corresponding
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#if 0 // This needs reimplementation with boost threads and synchronization
+
#include <gri_logger.h>
#include <stdio.h>
#include <stdarg.h>
@@ -172,3 +174,5 @@
if (n > -1 && n < (ssize_t) sizeof(buf))
write(buf, n);
}
+
+#endif
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/io/gri_logger.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,6 +22,8 @@
#ifndef INCLUDED_GRI_LOGGER_H
#define INCLUDED_GRI_LOGGER_H
+#if 0 // This needs reimplementation with boost threads and synchronization
+
#include <stddef.h>
#include <gnuradio/omnithread.h>
#include <gr_buffer.h>
@@ -52,4 +54,6 @@
void printf(const char *format, ...);
};
+#endif
+
#endif /* INCLUDED_GRI_LOGGER_H */
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_block_executor.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_block_executor.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_block_executor.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -68,7 +68,7 @@
int min_space = std::numeric_limits<int>::max();
for (int i = 0; i < d->noutputs (); i++){
- gr_buffer::scoped_lock guard(*d->output(i)->mutex());
+ gruel::scoped_lock guard(*d->output(i)->mutex());
#if 0
int n = round_down(d->output(i)->space_available(), output_multiple);
#else
@@ -163,7 +163,7 @@
/*
* Acquire the mutex and grab local copies of items_available and done.
*/
- gr_buffer::scoped_lock guard(*d->input(i)->mutex());
+ gruel::scoped_lock guard(*d->input(i)->mutex());
d_ninput_items[i] = d->input(i)->items_available();
d_input_done[i] = d->input(i)->done();
}
@@ -205,7 +205,7 @@
/*
* Acquire the mutex and grab local copies of items_available and done.
*/
- gr_buffer::scoped_lock guard(*d->input(i)->mutex());
+ gruel::scoped_lock guard(*d->input(i)->mutex());
d_ninput_items[i] = d->input(i)->items_available ();
d_input_done[i] = d->input(i)->done();
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -175,14 +175,14 @@
void
gr_buffer::update_write_pointer (int nitems)
{
- scoped_lock guard(*mutex());
+ gruel::scoped_lock guard(*mutex());
d_write_index = index_add (d_write_index, nitems);
}
void
gr_buffer::set_done (bool done)
{
- scoped_lock guard(*mutex());
+ gruel::scoped_lock guard(*mutex());
d_done = done;
}
@@ -251,7 +251,7 @@
void
gr_buffer_reader::update_read_pointer (int nitems)
{
- scoped_lock guard(*mutex());
+ gruel::scoped_lock guard(*mutex());
d_read_index = d_buffer->index_add (d_read_index, nitems);
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_buffer.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,7 +25,7 @@
#include <gr_runtime_types.h>
#include <boost/weak_ptr.hpp>
-#include <boost/thread.hpp>
+#include <gruel/thread.h>
class gr_vmcircbuf;
@@ -50,8 +50,6 @@
class gr_buffer {
public:
- typedef boost::unique_lock<boost::mutex> scoped_lock;
-
virtual ~gr_buffer ();
/*!
@@ -88,7 +86,7 @@
size_t nreaders() const { return d_readers.size(); }
gr_buffer_reader* reader(size_t index) { return d_readers[index]; }
- boost::mutex *mutex() { return &d_mutex; }
+ gruel::mutex *mutex() { return &d_mutex; }
// -------------------------------------------------------------------------
@@ -110,7 +108,7 @@
//
// The mutex protects d_write_index, d_done and the d_read_index's in the
buffer readers.
//
- boost::mutex d_mutex;
+ gruel::mutex d_mutex;
unsigned int d_write_index; // in items
[0,d_bufsize)
bool d_done;
@@ -185,8 +183,6 @@
class gr_buffer_reader {
public:
- typedef gr_buffer::scoped_lock scoped_lock;
-
~gr_buffer_reader ();
/*!
@@ -221,7 +217,7 @@
void set_done (bool done) { d_buffer->set_done (done); }
bool done () const { return d_buffer->done (); }
- boost::mutex *mutex() { return d_buffer->mutex(); }
+ gruel::mutex *mutex() { return d_buffer->mutex(); }
/*!
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,16 +26,14 @@
#include <gr_msg_queue.h>
#include <stdexcept>
-
gr_msg_queue_sptr
gr_make_msg_queue(unsigned int limit)
{
return gr_msg_queue_sptr (new gr_msg_queue(limit));
}
-
gr_msg_queue::gr_msg_queue(unsigned int limit)
- : d_not_empty(&d_mutex), d_not_full(&d_mutex),
+ : d_not_empty(), d_not_full(),
/*d_head(0), d_tail(0),*/ d_count(0), d_limit(limit)
{
}
@@ -51,10 +49,10 @@
if (msg->d_next)
throw std::invalid_argument("gr_msg_queue::insert_tail: msg already in
queue");
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock guard(d_mutex);
while (full_p())
- d_not_full.wait();
+ d_not_full.wait(guard);
if (d_tail == 0){
d_tail = d_head = msg;
@@ -68,17 +66,17 @@
msg->d_next.reset();
}
d_count++;
- d_not_empty.signal();
+ d_not_empty.notify_one();
}
gr_message_sptr
gr_msg_queue::delete_head()
{
- omni_mutex_lock l(d_mutex);
- gr_message_sptr m;
+ gruel::scoped_lock guard(d_mutex);
+ gr_message_sptr m;
while ((m = d_head) == 0)
- d_not_empty.wait();
+ d_not_empty.wait(guard);
d_head = m->d_next;
if (d_head == 0){
@@ -89,15 +87,15 @@
d_count--;
// m->d_next = 0;
m->d_next.reset();
- d_not_full.signal();
+ d_not_full.notify_one();
return m;
}
gr_message_sptr
gr_msg_queue::delete_head_nowait()
{
- omni_mutex_lock l(d_mutex);
- gr_message_sptr m;
+ gruel::scoped_lock guard(d_mutex);
+ gr_message_sptr m;
if ((m = d_head) == 0){
//return 0;
@@ -113,7 +111,7 @@
d_count--;
//m->d_next = 0;
m->d_next.reset();
- d_not_full.signal();
+ d_not_full.notify_one();
return m;
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,7 +23,7 @@
#define INCLUDED_GR_MSG_QUEUE_H
#include <gr_msg_handler.h>
-#include <gnuradio/omnithread.h>
+#include <gruel/thread.h>
class gr_msg_queue;
typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr;
@@ -35,14 +35,15 @@
* \ingroup misc
*/
class gr_msg_queue : public gr_msg_handler {
- omni_mutex d_mutex;
- omni_condition d_not_empty;
- omni_condition d_not_full;
- gr_message_sptr d_head;
- gr_message_sptr d_tail;
- unsigned int d_count; // # of messages in queue.
- unsigned int d_limit; // max # of messages in queue. 0 ->
unbounded
+ gruel::mutex d_mutex;
+ gruel::condition_variable d_not_empty;
+ gruel::condition_variable d_not_full;
+ gr_message_sptr d_head;
+ gr_message_sptr d_tail;
+ unsigned int d_count; // # of messages in queue.
+ unsigned int d_limit; // max # of messages in queue. 0 ->
unbounded
+
public:
gr_msg_queue(unsigned int limit);
~gr_msg_queue();
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.i
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.i
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_msg_queue.i
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -32,12 +32,6 @@
*/
%ignore gr_msg_queue;
class gr_msg_queue : public gr_msg_handler {
- omni_mutex d_mutex;
- omni_condition d_cond;
- gr_message_sptr d_head;
- gr_message_sptr d_tail;
- int d_count;
-
public:
gr_msg_queue(unsigned int limit);
~gr_msg_queue();
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,19 +27,11 @@
#include <stdexcept>
-#if 0
- #include <boost/thread.hpp>
- typedef boost::mutex mutex;
- typedef boost::mutex::scoped_lock scoped_lock;
-#else
- #include <gnuradio/omnithread.h>
- typedef omni_mutex mutex;
- typedef omni_mutex_lock scoped_lock;
-#endif
+#include <gruel/thread.h>
namespace gnuradio {
- static mutex s_mutex;
+ static gruel::mutex s_mutex;
typedef std::map<gr_basic_block*, gr_basic_block_sptr> sptr_map;
static sptr_map s_map;
@@ -47,7 +39,7 @@
detail::sptr_magic::create_and_stash_initial_sptr(gr_hier_block2 *p)
{
gr_basic_block_sptr sptr(p);
- scoped_lock l();
+ gruel::scoped_lock guard();
s_map.insert(sptr_map::value_type(static_cast<gr_basic_block *>(p), sptr));
}
@@ -68,7 +60,7 @@
* p is a subclass of gr_hier_block2, thus we've already created the
shared pointer
* and stashed it away. Fish it out and return it.
*/
- scoped_lock l();
+ gruel::scoped_lock guard();
sptr_map::iterator pos = s_map.find(static_cast<gr_basic_block *>(p));
if (pos == s_map.end())
throw std::invalid_argument("gr_sptr_magic: invalid pointer!");
@@ -78,4 +70,3 @@
return sptr;
}
};
-
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,7 +21,7 @@
#ifndef INCLUDED_GR_TPB_DETAIL_H
#define INCLUDED_GR_TPB_DETAIL_H
-#include <boost/thread.hpp>
+#include <gruel/thread.h>
class gr_block_detail;
@@ -29,13 +29,12 @@
* \brief used by thread-per-block scheduler
*/
struct gr_tpb_detail {
- typedef boost::unique_lock<boost::mutex> scoped_lock;
- boost::mutex mutex; //< protects all vars
+ gruel::mutex mutex; //< protects all vars
bool input_changed;
- boost::condition_variable input_cond;
+ gruel::condition_variable input_cond;
bool output_changed;
- boost::condition_variable output_cond;
+ gruel::condition_variable output_cond;
gr_tpb_detail()
: input_changed(false), output_changed(false) {}
@@ -53,7 +52,7 @@
//! Called by us
void clear_changed()
{
- scoped_lock guard(mutex);
+ gruel::scoped_lock guard(mutex);
input_changed = false;
output_changed = false;
}
@@ -63,7 +62,7 @@
//! Used by notify_downstream
void set_input_changed()
{
- scoped_lock guard(mutex);
+ gruel::scoped_lock guard(mutex);
input_changed = true;
input_cond.notify_one();
}
@@ -71,7 +70,7 @@
//! Used by notify_upstream
void set_output_changed()
{
- scoped_lock guard(mutex);
+ gruel::scoped_lock guard(mutex);
output_changed = true;
output_cond.notify_one();
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -54,7 +54,7 @@
case gr_block_executor::BLKD_IN: // Wait for input.
{
- gr_tpb_detail::scoped_lock guard(d->d_tpb.mutex);
+ gruel::scoped_lock guard(d->d_tpb.mutex);
while(!d->d_tpb.input_changed)
d->d_tpb.input_cond.wait(guard);
}
@@ -62,7 +62,7 @@
case gr_block_executor::BLKD_OUT: // Wait for output buffer space.
{
- gr_tpb_detail::scoped_lock guard(d->d_tpb.mutex);
+ gruel::scoped_lock guard(d->d_tpb.mutex);
while(!d->d_tpb.output_changed)
d->d_tpb.output_cond.wait(guard);
}
Modified:
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -35,7 +35,7 @@
#include <gnuradio/omnithread.h>
#include <string.h>
-#define LOGGING 0 // define to 0 or 1
+//#define LOGGING 0 // define to 0 or 1
#define SAMPLE_FORMAT paFloat32
typedef float sample_t;
@@ -85,8 +85,8 @@
int navail_samples = self->d_reader->items_available();
if (nreqd_samples <= navail_samples){ // We've got enough data...
- if (LOGGING)
- self->d_log->printf("PAsink cb: f/b = %4ld\n", framesPerBuffer);
+ //if (LOGGING)
+ // self->d_log->printf("PAsink cb: f/b = %4ld\n", framesPerBuffer);
// copy from ringbuffer into output buffer
memcpy(outputBuffer,
self->d_reader->read_pointer(),
@@ -99,8 +99,8 @@
}
else { // underrun
- if (LOGGING)
- self->d_log->printf("PAsink cb: f/b = %4ld UNDERRUN\n", framesPerBuffer);
+ //if (LOGGING)
+ // self->d_log->printf("PAsink cb: f/b = %4ld UNDERRUN\n",
framesPerBuffer);
self->d_nunderuns++;
::write(2, "aU", 2); // FIXME change to non-blocking call
@@ -139,8 +139,8 @@
d_nunderuns(0)
{
memset(&d_output_parameters, 0, sizeof(d_output_parameters));
- if (LOGGING)
- d_log = gri_logger::singleton();
+ //if (LOGGING)
+ // d_log = gri_logger::singleton();
PaError err;
int i, numDevices;
Modified:
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_sink.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -28,7 +28,7 @@
#include <string>
#include <portaudio.h>
#include <stdexcept>
-#include <gri_logger.h>
+//#include <gri_logger.h>
class audio_portaudio_sink;
typedef boost::shared_ptr<audio_portaudio_sink> audio_portaudio_sink_sptr;
@@ -79,7 +79,7 @@
// random stats
int d_nunderuns; // count of underruns
- gri_logger_sptr d_log; // handle to non-blocking
logging instance
+ //gri_logger_sptr d_log; // handle to non-blocking
logging instance
void output_error_msg (const char *msg, int err);
void bail (const char *msg, int err) throw (std::runtime_error);
Modified:
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.cc
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.cc
2009-07-21 03:58:36 UTC (rev 11465)
@@ -35,7 +35,7 @@
#include <gnuradio/omnithread.h>
#include <string.h>
-#define LOGGING 0 // define to 0 or 1
+//#define LOGGING 0 // define to 0 or 1
#define SAMPLE_FORMAT paFloat32
typedef float sample_t;
@@ -84,8 +84,8 @@
int nframes_room = self->d_writer->space_available() / nchan;
if (nframes_to_copy <= nframes_room){ // We've got room for the data ..
- if (LOGGING)
- self->d_log->printf("PAsrc cb: f/b = %4ld\n", framesPerBuffer);
+ //if (LOGGING)
+ // self->d_log->printf("PAsrc cb: f/b = %4ld\n", framesPerBuffer);
// copy from input buffer to ringbuffer
memcpy(self->d_writer->write_pointer(),
@@ -99,8 +99,8 @@
}
else { // overrun
- if (LOGGING)
- self->d_log->printf("PAsrc cb: f/b = %4ld OVERRUN\n", framesPerBuffer);
+ //if (LOGGING)
+ // self->d_log->printf("PAsrc cb: f/b = %4ld OVERRUN\n",
framesPerBuffer);
self->d_noverruns++;
::write(2, "aO", 2); // FIXME change to non-blocking call
@@ -144,8 +144,8 @@
d_noverruns(0)
{
memset(&d_input_parameters, 0, sizeof(d_input_parameters));
- if (LOGGING)
- d_log = gri_logger::singleton();
+ //if (LOGGING)
+ // d_log = gri_logger::singleton();
PaError err;
int i, numDevices;
Modified:
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gr-audio-portaudio/src/audio_portaudio_source.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -28,7 +28,7 @@
#include <string>
#include <portaudio.h>
#include <stdexcept>
-#include <gri_logger.h>
+//#include <gri_logger.h>
class audio_portaudio_source;
typedef boost::shared_ptr<audio_portaudio_source> audio_portaudio_source_sptr;
@@ -78,7 +78,7 @@
// random stats
int d_noverruns; // count of overruns
- gri_logger_sptr d_log; // handle to non-blocking
logging instance
+ //gri_logger_sptr d_log; // handle to non-blocking
logging instance
void output_error_msg (const char *msg, int err);
void bail (const char *msg, int err) throw (std::runtime_error);
Modified:
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/Makefile.am
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/Makefile.am
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/Makefile.am
2009-07-21 03:58:36 UTC (rev 11465)
@@ -34,4 +34,5 @@
realtime.h \
sys_pri.h \
thread_body_wrapper.h \
- thread_group.h
+ thread_group.h \
+ thread.h
Added:
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread.h
===================================================================
--- gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_THREAD_H
+#define INCLUDED_THREAD_H
+
+#include <boost/thread.hpp>
+
+namespace gruel {
+
+ typedef boost::mutex mutex;
+ typedef boost::unique_lock<boost::mutex> scoped_lock;
+ typedef boost::condition_variable condition_variable;
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_THREAD_H */
Modified:
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_body_wrapper.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_body_wrapper.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_body_wrapper.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,7 +21,7 @@
#ifndef INCLUDED_THREAD_BODY_WRAPPER_H
#define INCLUDED_THREAD_BODY_WRAPPER_H
-#include <boost/thread.hpp>
+#include <gruel/thread.h>
#include <exception>
#include <iostream>
Modified:
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_group.h
===================================================================
---
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_group.h
2009-07-20 18:47:24 UTC (rev 11464)
+++
gnuradio/branches/developers/jcorgan/omni/gruel/src/include/gruel/thread_group.h
2009-07-21 03:58:36 UTC (rev 11465)
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2001-2003 William E. Kempf
* Copyright (C) 2007 Anthony Williams
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* Distributed under the Boost Software License, Version 1.0. (See
accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,8 +15,8 @@
#ifndef INCLUDED_GRUEL_THREAD_GROUP_H
#define INCLUDED_GRUEL_THREAD_GROUP_H
+#include <gruel/thread.h>
#include <boost/utility.hpp>
-#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/function.hpp>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11465 - in gnuradio/branches/developers/jcorgan/omni: config gnuradio-core/src/lib/io gnuradio-core/src/lib/runtime gr-audio-portaudio/src gruel/src/include/gruel,
jcorgan <=