MCPcopy Create free account
hub / github.com/Genivia/ugrep / start_stdin

Method start_stdin

src/query.cpp:4173–4194  ·  view source on GitHub ↗

start a new stdin sender thread and pipe from sender to the search engine

Source from the content-addressed store, hash-verified

4171
4172// start a new stdin sender thread and pipe from sender to the search engine
4173void Query::start_stdin()
4174{
4175 // if standard input is searched, start thread to reproduce its text on demand
4176 if (flag_stdin)
4177 {
4178 // create a new pipe
4179 if (pipe(stdin_pipe_) < 0)
4180 {
4181 what_.assign("cannot create pipe");
4182 // error at the end of the line, not within
4183 error_ = line_wsize();
4184 return;
4185 }
4186
4187 // and assign it to the source
4188 Static::source = fdopen(stdin_pipe_[0], "rb");
4189
4190 // run stdin_sender in the background to push buffered standard input down the pipe
4191 stdin_stop = false;
4192 stdin_thread_ = std::thread(Query::stdin_sender, stdin_pipe_[1]);
4193 }
4194}
4195
4196// stop stdin sender thread
4197void Query::stop_stdin()

Callers

nothing calls this directly

Calls 2

assignMethod · 0.80
pipeFunction · 0.70

Tested by

no test coverage detected