# Stop() and wait() on topblock does not work on OS X

**URL:** <https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113>\
**Category:** GNU Radio\
**Created:** [September 18, 2014, 4:41pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113 "2014-09-18T16:41:10Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 18, 2014, 4:41pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/1 "2014-09-18T16:41:10Z")

</div>

Hi,  
my C++ program is already working great, except one major bug on OS X:

I cannot stop the flowgraph: When I call on the top block:

gr\_tb-\>stop();  
gr\_tb-\>wait();

It will hang on the wait. That means the program cannot quit nicely, but  
will always crash at exit. It´s working fine on Linux and Windows.  
Is there some known problem?

First I installed GnuRadio using macports (removed and then installed  
from source using depencies from macports).  
Then I removed all the macports stuff and installed all dependencies  
myself (with boost 1.56), same problem.

Best regards  
Stefan

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 18, 2014, 5:13pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/2 "2014-09-18T17:13:19Z")

</div>

Hi Stefan - Do you have an example program that I could do testing on?  
That would help expedite any fix. Thanks! - MLD

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 3:06pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/3 "2014-09-22T15:06:04Z")

</div>

Hi Michael,  
sorry, my mistake. I introduced a stupid bug in my short test program  
with a sine source so I got a similar result like in my complete  
program, although GnuRadio is working fine. The problem is probably  
located somewhere in OsmoSDR/rtl-sdr/libusb. Without any hardware  
connected (OsmoSDR generates null source) its working fine, with a  
RTL-Stick connected it doesnt work. I tried two different ones (E4000  
and R820T tuner), same result. Unfortunately I do not have any other  
hardware to test.  
Oh, I wont be on GRCon, flying to another continent just to get some  
bugs fixed is probably a bit too much.  
Thanks  
Stefan

Am 18.09.2014 17:11, schrieb Michael D.:

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 3:49pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/4 "2014-09-22T15:49:20Z")

</div>

Hi Stefan - Thanks for reporting back; no problems on any mistakes or  
bugs or not being at GRCon14. It sounds like stop() and wait() work on  
OSX within GNU Radio, and that the actual issue is when using a  
3rd-party interface between the hardware and GNU Radio. So, hopefully  
these other projects are listening / reading 🙂 - MLD

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 4:04pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/5 "2014-09-22T16:04:13Z")

</div>

Can somebody provide me with a program that I can use to test on OSX?  
I’m happy to provide patches … - MLD

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 4:09pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/6 "2014-09-22T16:09:49Z")

</div>

> Can somebody provide me with a program that I can use to test on OSX? I’m happy  
> to provide patches … - MLD

Well, as I said above, osmocom\_fft uses -\>stop() then -\>wait() in its  
shutdown procedure to ensure the flow graph is stopped before the GUI  
is destroyed. So running osmocom\_fft and clicking the ‘close’ of the  
window should trigger that.

Cheers,

```
Sylvain

```

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 7:34pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/7 "2014-09-22T19:34:21Z")

</div>

Ah; OK. Running osmocom\_fft using a HackRF Jawbreaker and everything  
works OK; I can do “stop”, “run”, and close without issues. Maybe this  
issue is specific to some RTL device(s) rather than OSX? - MLD

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 22, 2014, 4:02pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/8 "2014-09-22T16:02:21Z")

</div>

On Mon, Sep 22, 2014 at 3:47 PM, Michael D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Stefan - Thanks for reporting back; no problems on any mistakes or bugs or  
> not being at GRCon14. It sounds like stop() and wait() work on OSX within GNU  
> Radio, and that the actual issue is when using a 3rd-party interface between the  
> hardware and GNU Radio. So, hopefully these other projects are listening / reading  
> 🙂 - MLD

Well, it works on windows and linux according to the OP. (and since  
osmocom\_fft does a stop() wait(), I can definitely confirm the ‘linux’  
part).

Since none of the osmo people work on OSX, unless there is a confirmed  
working patch attached to the message, this is pretty unlikely to  
receive any attention.

Cheers,

```
Sylvain

```

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 23, 2014, 9:07am UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/9 "2014-09-23T09:07:18Z")

</div>

> Ah; OK. Running osmocom\_fft using a HackRF Jawbreaker and everything works OK;  
> I can do “stop”, “run”, and close without issues. Maybe this issue is specific to  
> some RTL device(s) rather than OSX? - MLD

Well, it definitely works with rtl on linux, but it wouldn’t suprise  
me if the issue was specific to the combination OSX+rtl since the  
‘stop’ path is highly dependent of the hw driver and its interactions  
with libusb.

Cheers,

```
Sylvain

```

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 25, 2014, 4:24pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/10 "2014-09-25T16:24:22Z")

</div>

Unfortunately I do not have any other hardware than two different RTL  
devices (one with E4000 tuner and one with R820T).  
I attached the most simple program to reproduce that error, it just  
connects the OsmoSDR source with a null sink, starts the flowgraph,  
waits a second and then stops it and exit.  
Working fine on Linux and Windows, but not on OS X (10.9), program never  
returns. Same problem with all stuff (boost/libusb…) self build or  
installed using ports.  
Is someone able to find the bug?

Thanks  
Stefan

Am 23.09.2014 09:06, schrieb Sylvain M.:

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 25, 2014, 7:17pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/11 "2014-09-25T19:17:03Z")

</div>

The NooElec R820T  
([Nooelec - Nooelec NESDR Mini SDR & DVB-T USB Stick (RTL2832 + R820T) w/ Antenna - SDR Receivers - Software Defined Radio](http://www.nooelec.com/store/sdr/sdr-receivers/nesdr-mini-rtl2832-r820t.html))  
looks exactly like my R820T device, just a different branding. The  
output I get:

gr-osmosdr v0.1.3-1-g4bb2fa4e (0.1.4git) gnuradio 3.7.5  
built-in source types: file fcd rtl rtl\_tcp rfspace  
Using device #0 Realtek RTL2838UHIDIR SN: 00000001  
Found Rafael Micro R820T tuner

I compiled with the same command-line, unfortunately I do not have  
access to a 10.8 mac.

Am 25.09.2014 18:25, schrieb Michael D.:

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 25, 2014, 6:26pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/12 "2014-09-25T18:26:54Z")

</div>

On Sep 25, 2014, at 10:22 AM, Stefan O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Unfortunately I do not have any other hardware than two different RTL  
> devices (one with E4000 tuner and one with R820T).  
> I attached the most simple program to reproduce that error, it just  
> connects the OsmoSDR source with a null sink, starts the flowgraph,  
> waits a second and then stops it and exit.  
> Working fine on Linux and Windows, but not on OS X (10.9), program never  
> returns. Same problem with all stuff (boost/libusb…) self build or  
> installed using ports.  
> Is someone able to find the bug?

I compiled your code using  
{{{  
c++ -O2 -I/opt/local/include -L/opt/local/lib -lgnuradio-osmosdr  
-lgnuradio-runtime -lgnuradio-blocks -lboost\_system-mt -Wall -o  
osmo\_test osmo\_test.cc  
}}}  
then tried it using the following devices without issues (returns  
cleanly), using MacPorts for all of the software installs, running on  
OSX 10.8.5 (latest updates), Xcode 5.1.1 (Build version 5B1008):

- HackRF Jawbreaker
- NooElec R820T
- ER B210

I’ll try on 10.9 shortly, since maybe this is an OS specific issue. -  
MLD

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [October 23, 2014, 9:57pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/13 "2014-10-23T21:57:26Z")

</div>

I just compiled against latest gnuradio from git, still the same  
problem.

Best regards  
Stefan

Am 25.09.2014 19:51, schrieb Michael D.:

---

<div class="post-metadata">

**Author:** ![Stefan\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stefan\_O](https://www.ruby-forum.com/u/Stefan_O)\
**Post date:** [September 25, 2014, 7:53pm UTC](https://www.ruby-forum.com/t/stop-and-wait-on-topblock-does-not-work-on-os-x/232113/14 "2014-09-25T19:53:17Z")

</div>

Mine outputs (in gdb):  
{{{  
gr-osmosdr v0.1.3-1-g4bb2fa4e (0.1.4git) gnuradio v3.7.x-xxx-xunknown  
built-in source types: file fcd rtl rtl\_tcp uhd hackrf bladerf rfspace  
[Reading symbols for shared libraries . done]  
Using device #0 Realtek RTL2838UHIDIR SN: 00000001  
Found Rafael Micro R820T tuner

Program exited normally.  
(gdb)  
}}}

Can you try updating GNU Radio to the latest GIT master? You’ll have to  
reinstall gr-osmosdr too. I’m installing the 10.10 preview right now  
for GR / UHD testing; I’ll try this code on 10.10 and 10.9 soon. - MLD
