[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 08/148: Removed omnithreads dependency from
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 08/148: Removed omnithreads dependency from libusrp2, still debugging |
Date: |
Mon, 15 Aug 2016 00:47:19 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.
commit 08594ae7777d374c25b67c7358293b646c3def3c
Author: Johnathan Corgan <address@hidden>
Date: Fri Oct 30 19:02:54 2009 -0700
Removed omnithreads dependency from libusrp2, still debugging
---
gruel/src/include/gruel/thread.h | 2 ++
usrp2/host/lib/Makefile.am | 1 -
usrp2/host/lib/control.cc | 25 +++++++++++++------------
usrp2/host/lib/control.h | 6 +++---
usrp2/host/lib/ring.cc | 12 ++++++------
usrp2/host/lib/ring.h | 6 +++---
usrp2/host/lib/usrp2_impl.cc | 20 ++++++++++----------
usrp2/host/lib/usrp2_impl.h | 13 +++++++------
8 files changed, 44 insertions(+), 41 deletions(-)
diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h
index 0e7acaa..dc10d41 100644
--- a/gruel/src/include/gruel/thread.h
+++ b/gruel/src/include/gruel/thread.h
@@ -22,12 +22,14 @@
#define INCLUDED_THREAD_H
#include <boost/thread.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
namespace gruel {
typedef boost::mutex mutex;
typedef boost::unique_lock<boost::mutex> scoped_lock;
typedef boost::condition_variable condition_variable;
+ typedef boost::posix_time::time_duration duration;
} /* namespace gruel */
diff --git a/usrp2/host/lib/Makefile.am b/usrp2/host/lib/Makefile.am
index ea28c68..0c3e180 100644
--- a/usrp2/host/lib/Makefile.am
+++ b/usrp2/host/lib/Makefile.am
@@ -48,7 +48,6 @@ libusrp2_la_SOURCES = \
usrp2_impl.cc
libusrp2_la_LIBADD = \
- $(OMNITHREAD_LA) \
$(GRUEL_LA) \
$(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
diff --git a/usrp2/host/lib/control.cc b/usrp2/host/lib/control.cc
index bb71f79..a5bbc56 100644
--- a/usrp2/host/lib/control.cc
+++ b/usrp2/host/lib/control.cc
@@ -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
*
@@ -23,14 +23,14 @@
#include <config.h>
#endif
-#include <gnuradio/omni_time.h>
#include "control.h"
#include <iostream>
+#include <gruel/thread.h>
namespace usrp2 {
pending_reply::pending_reply(unsigned int rid, void *buffer, size_t len)
- : d_rid(rid), d_buffer(buffer), d_len(len), d_mutex(), d_cond(&d_mutex),
+ : d_rid(rid), d_buffer(buffer), d_len(len), d_mutex(), d_cond(),
d_complete(false)
{
}
@@ -43,22 +43,23 @@ namespace usrp2 {
int
pending_reply::wait_for_completion(double secs)
{
- omni_time abs_timeout = omni_time::time(omni_time(secs));
- omni_mutex_lock l(d_mutex);
- while (!d_complete){
- int r = d_cond.timedwait(abs_timeout.d_secs, abs_timeout.d_nsecs);
- if (r == 0) // timed out
- return 0;
- }
+ gruel::scoped_lock l(d_mutex);
+ //gruel::duration td(0, 0, secs, 0);
+
+ //if (!d_complete && !d_cond.timed_wait(l, td))
+ // return 0; // timed out
+
+ // DEBUG: don't implement timeout
+ d_cond.wait(l);
return 1;
}
void
pending_reply::notify_completion()
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock l(d_mutex);
d_complete = true;
- d_cond.signal();
+ d_cond.notify_one();
}
} // namespace usrp2
diff --git a/usrp2/host/lib/control.h b/usrp2/host/lib/control.h
index 8769e45..91076a6 100644
--- a/usrp2/host/lib/control.h
+++ b/usrp2/host/lib/control.h
@@ -19,7 +19,7 @@
#ifndef INCLUDED_CONTROL_H
#define INCLUDED_CONTROL_H
-#include <gnuradio/omnithread.h>
+#include <gruel/thread.h>
#include <usrp2_eth_packet.h>
namespace usrp2 {
@@ -122,8 +122,8 @@ namespace usrp2 {
size_t d_len;
// d_mutex is used with d_cond and also protects d_complete
- omni_mutex d_mutex;
- omni_condition d_cond;
+ gruel::mutex d_mutex;
+ gruel::condition_variable d_cond;
bool d_complete;
public:
diff --git a/usrp2/host/lib/ring.cc b/usrp2/host/lib/ring.cc
index 3c45821..71bfadd 100644
--- a/usrp2/host/lib/ring.cc
+++ b/usrp2/host/lib/ring.cc
@@ -29,7 +29,7 @@ namespace usrp2 {
ring::ring(unsigned int entries)
: d_max(entries), d_read_ind(0), d_write_ind(0), d_ring(entries),
- d_mutex(), d_not_empty(&d_mutex)
+ d_mutex(), d_not_empty()
{
for (unsigned int i = 0; i < entries; i++) {
d_ring[i].d_base = 0;
@@ -40,15 +40,15 @@ namespace usrp2 {
void
ring::wait_for_not_empty()
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock l(d_mutex);
while (empty())
- d_not_empty.wait();
+ d_not_empty.wait(l);
}
bool
ring::enqueue(void *p, size_t len)
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock l(d_mutex);
if (full())
return false;
@@ -56,14 +56,14 @@ namespace usrp2 {
d_ring[d_write_ind].d_base = p;
inc_write_ind();
- d_not_empty.signal();
+ d_not_empty.notify_one();
return true;
}
bool
ring::dequeue(void **p, size_t *len)
{
- omni_mutex_lock l(d_mutex);
+ gruel::scoped_lock l(d_mutex);
if (empty())
return false;
diff --git a/usrp2/host/lib/ring.h b/usrp2/host/lib/ring.h
index 19ae9ae..3437132 100644
--- a/usrp2/host/lib/ring.h
+++ b/usrp2/host/lib/ring.h
@@ -21,10 +21,10 @@
#ifndef INCLUDED_RING_H
#define INCLUDED_RING_H
-#include <gnuradio/omnithread.h>
#include <stddef.h>
#include <vector>
#include <boost/shared_ptr.hpp>
+#include <gruel/thread.h>
namespace usrp2 {
@@ -46,8 +46,8 @@ namespace usrp2 {
};
std::vector<ring_desc> d_ring;
- omni_mutex d_mutex;
- omni_condition d_not_empty;
+ gruel::mutex d_mutex;
+ gruel::condition_variable d_not_empty;
void inc_read_ind()
{
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 1ac877c..d3bf66c 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -135,8 +135,6 @@ namespace usrp2 {
d_pf_data(0),
d_pf_ctrl(0),
d_interface_name(ifc),
- d_data_running(false),
- d_ctrl_running(false),
d_rx_seqno(-1),
d_tx_seqno(0),
d_next_rid(0),
@@ -146,11 +144,13 @@ namespace usrp2 {
d_num_rx_bytes(0),
d_num_enqueued(0),
d_enqueued_mutex(),
- d_data_pending_cond(&d_enqueued_mutex),
+ d_data_pending_cond(),
d_channel_rings(NCHANS),
d_tx_interp(0),
d_rx_decim(0),
- d_dont_enqueue(true)
+ d_dont_enqueue(true),
+ d_ctrl_running(false),
+ d_data_running(false)
{
if (!d_eth_data->open(ifc, htons(U2_DATA_ETHERTYPE)))
throw std::runtime_error("Unable to open/register USRP2 data protocol");
@@ -401,7 +401,7 @@ namespace usrp2 {
usrp2::impl::stop_data_thread()
{
d_data_running = false;
- d_data_pending_cond.signal();
+ d_data_pending_cond.notify_one();
d_data_thread->join();
}
@@ -424,9 +424,9 @@ namespace usrp2 {
// The channel ring thread that decrements d_num_enqueued to zero
// will signal this thread to continue.
{
- omni_mutex_lock l(d_enqueued_mutex);
+ gruel::scoped_lock l(d_enqueued_mutex);
while(d_num_enqueued > 0 && d_data_running)
- d_data_pending_cond.wait();
+ d_data_pending_cond.wait(l);
}
}
d_data_running = false;
@@ -511,7 +511,7 @@ namespace usrp2 {
unsigned int chan = u2p_chan(&pkt->hdrs.fixed);
{
- omni_mutex_lock l(d_channel_rings_mutex);
+ gruel::scoped_lock l(d_channel_rings_mutex);
if (!d_channel_rings[chan]) {
DEBUG_LOG("!");
@@ -677,7 +677,7 @@ namespace usrp2 {
}
{
- omni_mutex_lock l(d_channel_rings_mutex);
+ gruel::scoped_lock l(d_channel_rings_mutex);
if (d_channel_rings[channel]) {
std::cerr << "usrp2: channel " << channel
<< " already streaming" << std::endl;
@@ -737,7 +737,7 @@ namespace usrp2 {
op_generic_t reply;
{
- omni_mutex_lock l(d_channel_rings_mutex);
+ gruel::scoped_lock l(d_channel_rings_mutex);
memset(&cmd, 0, sizeof(cmd));
init_etf_ctrl_hdrs(&cmd.h, d_addr, 0, -1);
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index 6073d82..e28ab89 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -22,6 +22,7 @@
#include <usrp2/usrp2.h>
#include <usrp2/data_handler.h>
#include <usrp2_eth_packet.h>
+#include <gruel/thread.h>
#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
#include "control.h"
@@ -75,14 +76,14 @@ namespace usrp2 {
unsigned int d_num_rx_bytes;
unsigned int d_num_enqueued;
- omni_mutex d_enqueued_mutex;
- omni_condition d_data_pending_cond;
+ gruel::mutex d_enqueued_mutex;
+ gruel::condition_variable d_data_pending_cond;
// all pending_replies are stack allocated, thus no possibility of leaking
these
pending_reply *d_pending_replies[NRIDS]; // indexed by 8-bit reply id
std::vector<ring_sptr> d_channel_rings; // indexed by 5-bit channel
number
- omni_mutex d_channel_rings_mutex;
+ gruel::mutex d_channel_rings_mutex;
db_info d_tx_db_info;
db_info d_rx_db_info;
@@ -93,14 +94,14 @@ namespace usrp2 {
bool d_dont_enqueue;
void inc_enqueued() {
- omni_mutex_lock l(d_enqueued_mutex);
+ gruel::scoped_lock l(d_enqueued_mutex);
d_num_enqueued++;
}
void dec_enqueued() {
- omni_mutex_lock l(d_enqueued_mutex);
+ gruel::scoped_lock l(d_enqueued_mutex);
if (--d_num_enqueued == 0)
- d_data_pending_cond.signal();
+ d_data_pending_cond.notify_one();
}
static bool parse_mac_addr(const std::string &s, u2_mac_addr_t *p);
- [Commit-gnuradio] [gnuradio] 10/148: Fix incorrect comparison, (continued)
- [Commit-gnuradio] [gnuradio] 10/148: Fix incorrect comparison, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 13/148: usrp2: remove install data hook for usrp2_socket_opener, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 04/148: Hosekeeping after control/data separation., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 05/148: Removed references to U2_ETHERTYPE and CONTROL_CHAN. Moved non-txrx-related apps in firmware broken by this., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 06/148: Common naming convention for control and data thread stuff., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 02/148: working a separate ctrl ethernet device into the code, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 07/148: using boost threads for control and data, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 09/148: Refactored timeout handling, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 17/148: Began work on eth data transport class. Switched send in transport to use iovecs. Pass mac addr into eth transports rather than re-parsing., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 14/148: Created transport abstraction. Implemented ethernet transport for control. Control transport works in usrp impl. Needs a lot of cleanup., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 08/148: Removed omnithreads dependency from libusrp2, still debugging,
git <=
- [Commit-gnuradio] [gnuradio] 18/148: Added a callback into the channel ring enqueue and dequeue. This will allow the deqeue caller to make an arbitrary call when its done with the data. Currently, the enqueue caller makes this callback a release_frames., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 15/148: virtual destructor and shared ptr for transport, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 28/148: Cleaned up the parse ethernet stuff. Made an official max_buffs method for the transport., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 20/148: Created sbuff class to house chunks of memory, their length, and possible callback for freeing/cleanup. Switched ring and transport to make use of the sbuff on receive., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 37/148: Fixes usrp2 firmware configure with mb-gcc on ubuntu 9.10/autoconf 2.64. Disables the regression test for fopen since stdio is non-functional., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 22/148: usrp2 impl working with data transport. not up to full potential yet, but working. needs major cleanup., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 23/148: Changed the transport to return a vector of sbuffs. This way the ethernet can pass up as many buffs as ready., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 11/148: some house keeping while trying to fix thread exception, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 12/148: Disable interruption in those functions that use interruption points such as sleep, wait, and timed_wait., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 30/148: being more c++y with the ring, git, 2016/08/14