_______________________________________________Hi,
I'm learning to use Boost.asio by going through the tutorials at [1].However, the listing for "Synchronizing handlers in multithreaded programs" crashes on my Ubuntu. Source listing (about 70 lines) is at [2]. I have given my compilation steps, stack trace from gdb, and boost information below. Can you please advise how I can get this working right?
I compiled and ran as follows:
$ g++ -g -o timer_5.1 timer_5.1.cpp -lpthread -lboost_thread
$ ./timer_5.1Timer 1: 0Timer 2: 1Timer 1: 2Timer 2: 3Timer 1: 4Timer 2: 5Timer 1: 6Timer 2: 7Timer 1: 8Timer 2: 9Segmentation fault (core dumped)
The backtrace from gdb is:
$ cat gdb_log.txt#0 0x00007ffff799f88b in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1#1 0x00007ffff79a0bd5 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1#2 0x00007ffff7bbb6db in start_thread (arg=0x7ffff6851700) at pthread_create.c:463#3 0x00007ffff711e71f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
I have the following boost library installed:$ sudo apt show libboost-all-devPackage: libboost-all-devVersion: 1.65.1.0ubuntu1Priority: optionalSection: universe/libdevelSource: boost-defaultsOrigin: UbuntuMaintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>Original-Maintainer: Debian Boost Team <pkg-boost-devel@lists.alioth.debian.org>Installed-Size: 10.2 kBDepends: libboost-dev, libboost-tools-dev, libboost-atomic-dev, libboost-chrono-dev, libboost-container-dev, libboost-context-dev, libboost-coroutine-dev, libboost-date-time-dev, libboost-exception-dev, libboost-fiber-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-graph-parallel-dev, libboost-iostreams-dev, libboost-locale-dev, libboost-log-dev, libboost-math-dev, libboost-mpi-dev, libboost-mpi-python-dev, libboost-numpy-dev, libboost-program-options-dev, libboost-python-dev, libboost-random-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libboost-stacktrace-dev, libboost-system-dev, libboost-test-dev, libboost-thread-dev, libboost-timer-dev, libboost-type-erasure-dev, libboost-wave-devHomepage: http://www.boost.org/Download-Size: 2,340 BAPT-Manual-Installed: yes. . .Thanks in advance.
Thanks,Senthil.
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users