boost :: iostreams :: stream thread safety

时间:2013-12-20 22:26:24

标签: c++ boost boost-iostreams

如果我的接收器是线程安全的,我可以在没有同步的情况下从多个线程写入boost :: iostreams :: stream吗?

class my_sink : boost::iostreams::sink {
public:
    my_sink(param p) {}

    std::streamsize write(const char_type *s, std::streamsize n) {
        // thread-safe implementation
    }
};

boost::iostreams::stream<my_sink> my_stream(parameter);

void thread1() {
    my_stream << "some output";
}

void thread2() {
    my_stream << "some output";
}

0 个答案:

没有答案