/* -------------------------------------------------------------------- * API function to make sure a worker is running, a proper private copy * of the data is made, the data eneterd into the queue and the worker * is signalled. */ int send_blocking_req_internal( blocking_child * c, blocking_pipe_header * hdr, void * data ) { blocking_pipe_header * threadcopy; size_t payload_octets; REQUIRE(hdr != NULL); REQUIRE(data != NULL); DEBUG_REQUIRE(BLOCKING_REQ_MAGIC == hdr->magic_sig); if (hdr->octets <= sizeof(*hdr)) return 1; /* failure */ payload_octets = hdr->octets - sizeof(*hdr); if (NULL == c->thread_ref) start_blocking_thread(c); threadcopy = emalloc(hdr->octets); memcpy(threadcopy, hdr, sizeof(*hdr)); memcpy((char *)threadcopy + sizeof(*hdr), data, payload_octets); return queue_req_pointer(c, threadcopy); }
/* * req_child_exit() runs in the parent. */ int req_child_exit( blocking_child *c ) { return queue_req_pointer(c, CHILD_EXIT_REQ); }