qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adel Boutros <Adelbout...@live.com>
Subject [Proton-c C++ 0.16.0] [Solaris Sparc] [GCC 4.9.2] Assuming threads will propage exceptions
Date Wed, 26 Jul 2017 10:51:33 GMT

I hope you missed my mails about Solaris 😉

We are currently testing whether we can compile on Solaris using GCC 4.9.2. We were successful
in doing so for Solaris x86 but we have hit a problem in Sparc.

It seems related to certain assumptions made around how threads propagates exceptions:

The failing test is "examples/cpp/example_test.py: test_ssl_bad_name"

In examples/cpp/ssl.cpp [1], it spawns another thread and wait for it to throw an exception.

However, if you check the thread documentation[2], it states the propagation of exceptions
is not guaranteed[3].

So I was wondering if the assumption that Proton makes is not a big dangerous and should be

Simpler Example

#include <stdexcept>
#include <iostream>
#include <thread>

class example_cert_error : public std::runtime_error
        explicit example_cert_error(const std::string& s) : std::runtime_error(s) {}

int main(int argc, char** argv) {
    try {
        std::thread th([](){throw example_cert_error("my error"); });
    } catch (const example_cert_error& ce) {
        std::cout << "Caught: " << ce.what() << std::endl;
    return 0;

Solaris X86

$ g++49 -std=c++11 throw.cpp -o throw
$ ./throw
Caught: my error

Solaris Sparc
$ g++49 -std=c++11 throw.cpp -o throw
$ ./throw
terminate called without an active exception
Abort (core dumped)

[1]: https://github.com/apache/qpid-proton/blob/0.16.x/examples/cpp/ssl.cpp#L178

[2]: http://en.cppreference.com/w/cpp/thread/thread

[3]: The top-level function may communicate its return value or an exception to the caller

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message