This comes from a static constructor in opencv2:
(gdb) bt
#0 __pthread_create_2_1 (newthread=0x7fffe8974438, attr=0x0,
start_routine=0x7fffe876c5b0, arg=0x0) at pthread_create.c:505
#1 0x00007fffe876c7ef in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#2 0x00007fffe876a915 in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#3 0x00007fffe8762b1d in libusb_init ()
from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#4 0x00007ffff128c55c in ?? () from /usr/lib/x86_64-linux-gnu/libdc1394.so.22
#5 0x00007ffff1278b69 in dc1394_new ()
from /usr/lib/x86_64-linux-gnu/libdc1394.so.22
#6 0x00007ffff5bfbb19 in CvDC1394::CvDC1394() ()
from /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4
#7 0x00007ffff5be6540 in ?? ()
from /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4
#8 0x00007ffff7de76ca in call_init (l=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x7fffffffdff8, env=env@entry=0x7fffffffe008)
at dl-init.c:72
#9 0x00007ffff7de77db in call_init (env=0x7fffffffe008, argv=0x7fffffffdff8,
argc=1, l=<optimized out>) at dl-init.c:30
#10 _dl_init (main_map=0x7ffff7ffe168, argc=1, argv=0x7fffffffdff8,
env=0x7fffffffe008) at dl-init.c:120
#11 0x00007ffff7dd7c6a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
The problem is that libusb_init() creates a thread. As this is invoked
from a static variable constructor, it is invoked before main(), so
before main() can change the default signal mask of all threads via
pthread_sigmask(). Thus, as soon as the periodic task timer is started,
the thread from libusb that does not have SIGALRM blocked gets the
signal and terminates the program (default SIGALRM action).
I'll think about a possible clean solution.