TestResult * receive_test_result (int waserror) { FILE *fp; RcvMsg *rmsg; TestResult *result; fp = get_pipe (); if (fp == NULL) { eprintf ("Error in call to get_pipe", __FILE__, __LINE__ - 2); } rewind (fp); rmsg = punpack (fp); if (rmsg == NULL) { eprintf ("Error in call to punpack", __FILE__, __LINE__ - 4); } teardown_pipe (); setup_pipe (); result = construct_test_result (rmsg, waserror); rcvmsg_free (rmsg); return result; }
void MythSocketThread::StartReadyReadThread(void) { QMutexLocker locker(&m_readyread_lock); if (!m_readyread_run) { atexit(ShutdownRRT); setup_pipe(m_readyread_pipe, m_readyread_pipe_flags); m_readyread_run = true; start(); m_readyread_started_wait.wait(&m_readyread_lock); } }
void extract_actions() { // Extract the actions action_extractor::extract(nullptr, config, actions); if(!mpi_mode) { // Setup data pipes for(action & a : actions) if(a.t == pipe) setup_pipe(a); } }
void execute(std::function<void()> f) { if(mpi_mode && !master_instance) { // Setup data pipes bool firstJob = true; while(true) { std::string local_config = send_command(RQJ); if(local_config.empty()) break; if(firstJob) { for(action & a : actions) if(a.t == pipe) setup_pipe(a); firstJob = false; } parse_raw_config_str(local_config.c_str()); f(); send_command(DNE); } } else { if(actions.size() == 0) f(); else { int action_size = 1; for(auto& a : actions) action_size *= a.size(); int cur = 0; execute_action(0, action_size, cur, f); } if(!mpi_mode) { measure_time(); store_timing(); } } }
void WritePipe::run() { DWORD numBytesWritten = 0; setup_pipe(); while(running) { if(data_ptr == NULL) { continue; } // This call blocks until a client process reads all the data //rdtscll(r_start); bool result = WriteFile( _pipe, // handle to our outbound pipe data_ptr, // data to send data_len, // length of data to send (bytes) &numBytesWritten, // will store actual amount of data sent NULL // not using overlapped IO ); //rdtscll(r_end); Sleep(39); //data_ptr = NULL; if (!result) { CloseHandle(_pipe); if(running) { traceerr("Error! FFMPEG connection lost!"); running = false; setup_pipe(); } } } }
int main(int argc, char *argv[]) { int fd[2]; setup_udp("udp_0send", fd); try_0send("udp_0send", fd[0]); close_both(fd); setup_udp("udp_0write", fd); try_0write("udp_0write", fd[0]); close_both(fd); setup_tcp("tcp_0send", fd); try_0send("tcp_0send", fd[0]); close_both(fd); setup_tcp("tcp_0write", fd); try_0write("tcp_0write", fd[0]); close_both(fd); setup_udsstream("udsstream_0send", fd); try_0send("udsstream_0send", fd[0]); close_both(fd); setup_udsstream("udsstream_0write", fd); try_0write("udsstream_0write", fd[0]); close_both(fd); setup_udsdgram("udsdgram_0send", fd); try_0send("udsdgram_0send", fd[0]); close_both(fd); setup_udsdgram("udsdgram_0write", fd); try_0write("udsdgram_0write", fd[0]); close_both(fd); setup_pipe("pipe_0write", fd); try_0write("pipd_0write", fd[0]); close_both(fd); setup_fifo("fifo_0write", fd); try_0write("fifo_0write", fd[0]); close_both(fd); return (0); }
void setup_messaging(void) { setup_pipe(); }