我正在尝试从一个管道读取EXR流,处理它们并将结果写入不同的管道。在这种情况下,它们被命名为管道,但它们也可以是stdin和stdout。
当管道干涸时,我的问题就出现了。 OpenEXR不喜欢尝试读取任何内容并使用以下堆栈跟踪崩溃。
(gdb) run in.exr out.exr
Starting program: /Users/jon/Library/Developer/Xcode/DerivedData/compressor-abhdftqzleulxsfkpidvcazfowwo/Build/Products/Debug/compressor in.exr out.exr
Reading symbols for shared libraries +++++++++......................................................................................................... done
Reading symbols for shared libraries ............ done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
terminate called throwing an exception
Program received signal SIGABRT, Aborted.
0x00007fff90957ce2 in __pthread_kill ()
(gdb) backtrace
#0 0x00007fff90957ce2 in __pthread_kill ()
#1 0x00007fff866f27d2 in pthread_kill ()
#2 0x00007fff866e3a7a in abort ()
#3 0x00007fff8643c7bc in abort_message ()
#4 0x00007fff86439fcf in default_terminate ()
#5 0x00007fff844d61cd in _objc_terminate ()
#6 0x00007fff8643a001 in safe_handler_caller ()
#7 0x00007fff86439fed in unexpected_defaults_to_terminate ()
#8 0x00007fff8643a040 in __cxxabiv1::__unexpected ()
#9 0x00007fff8643aefe in __cxa_call_unexpected ()
#10 0x0000000100008cfb in exr::ReadEXR (pixelBuffer=@0x7fff5fbfee00, is=@0x7fff5fbfeef8) at /Users/jon/Development/compressor/compressor/exr.cpp:47
#11 0x0000000100001c39 in main (argc=4, argv=0x7fff5fbffaa8) at /Users/jon/Development/compressor/compressor/main.cpp:79
我真的希望OpenEXR阻止该线程,直到有更多数据可用,但是如果有一些方法可以手动检查是否有更多数据可以做,只要它有点健壮。
感谢。
答案 0 :(得分:0)
这个问题的解决方案确实是扩展了Imf :: Istream,并在输入管道干涸时实现它。
对于这个特定的问题,需要考虑一些因素,比如管道不可寻找而且不知道它们的位置,但是它们可以解决。