Re: Boost.asio. Crash in Tutorial Timer.5, "Synchronizing handlers in multithreaded programs"

kila suelika via Boost-users <[email protected]>
Newsgroups gmane.comp.lib.boost.user
Message-ID <CAH8XdD3SkhrboXxv69qPsDZvPA9X7pw9xeg6_NY34ZM3Dovh0w@mail.gmail.com>
Why didn't you try a newer version?  1.65 is too old.

On Thu, Nov 11, 2021 at 1:29 PM Senthil Cheetancheri via Boost-users <
[email protected]> wrote:

> 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?
>
> [1]
> https://www.boost.org/doc/libs/1_77_0/doc/html/boost_asio/tutorial.html
> [2]
> https://www.boost.org/doc/libs/1_77_0/doc/html/boost_asio/tutorial/tuttimer5/src.html
>
> I compiled and ran as follows:
>
> $ g++ -g -o timer_5.1 timer_5.1.cpp -lpthread  -lboost_thread
> $ ./timer_5.1
> Timer 1: 0
> Timer 2: 1
> Timer 1: 2
> Timer 2: 3
> Timer 1: 4
> Timer 2: 5
> Timer 1: 6
> Timer 2: 7
> Timer 1: 8
> Timer 2: 9
> Segmentation 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-dev
> Package: libboost-all-dev
> Version: 1.65.1.0ubuntu1
> Priority: optional
> Section: universe/libdevel
> Source: boost-defaults
> Origin: Ubuntu
> Maintainer: Ubuntu Developers <[email protected]>
> Original-Maintainer: Debian Boost Team <
> [email protected]>
> Bugs: https://bugs.launchpad.net/ubuntu/+filebug
> Installed-Size: 10.2 kB
> Depends: 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-dev
> Homepage: http://www.boost.org/
> Download-Size: 2,340 B
> APT-Manual-Installed: yes
> . . .
>
> Thanks in advance.
>
> Thanks,
> Senthil.
> _______________________________________________
> Boost-users mailing list
> [email protected]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>

_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.