src/dpdk/lib/librte_eal/linux/eal_thread.c
int
rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned int worker_id)
{
	int n;
	char c = 0;
	int m2w = lcore_config[worker_id].pipe_main2worker[1];
	int w2m = lcore_config[worker_id].pipe_worker2main[0];
	int rc = -EBUSY;

	if (lcore_config[worker_id].state != WAIT)
		goto finish;

	lcore_config[worker_id].f = f;
	lcore_config[worker_id].arg = arg;

	/* send message */
	n = 0;
	while (n == 0 || (n < 0 && errno == EINTR))
		n = write(m2w, &c, 1);
	if (n < 0)
		rte_panic("cannot write on configuration pipe\n");

	/* wait ack */
	do {
		n = read(w2m, &c, 1);
	} while (n < 0 && errno == EINTR);

	if (n <= 0)
		rte_panic("cannot read on configuration pipe\n");

	rc = 0;
finish:
	rte_eal_trace_thread_remote_launch(f, arg, worker_id, rc);
	return rc;
}
/*
 * Send a message to a worker lcore identified by worker_id to call a
 * function f with argument arg. Once the execution is done, the
 * remote lcore switch in FINISHED state.
 */
Send a message to a worker lcore identified by worker_id to call a
function f with argument arg. Once the execution is done, the
remote lcore switch in FINISHED state.
Send a message to a worker lcore identified by worker_id to call a function f with argument arg . Once the execution is done the remote lcore switch in FINISHED state .
int
rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned int worker_id)
{
	int n;
	char c = 0;
	int m2w = lcore_config[worker_id].pipe_main2worker[1];
	int w2m = lcore_config[worker_id].pipe_worker2main[0];
	int rc = -EBUSY;
	if (lcore_config[worker_id].state != WAIT)
		goto finish;
	lcore_config[worker_id].f = f;
	lcore_config[worker_id].arg = arg;
	n = 0;
	while (n == 0 || (n < 0 && errno == EINTR))
		n = write(m2w, &c, 1);
	if (n < 0)
		rte_panic("cannot write on configuration pipe\n");
	do {
		n = read(w2m, &c, 1);
	} while (n < 0 && errno == EINTR);
	if (n <= 0)
		rte_panic("cannot read on configuration pipe\n");
	rc = 0;
finish:
	rte_eal_trace_thread_remote_launch(f, arg, worker_id, rc);
	return rc;
}
int rte_eal_remote_launch ( int ( * f ) ( void * ) , void * arg , unsigned int worker_id ) { int n ; char c = 0 ; int m2w = lcore_config [ worker_id ] . pipe_main2worker [ 1 ] ; int w2m = lcore_config [ worker_id ] . pipe_worker2main [ 0 ] ; int rc = - EBUSY ; if ( lcore_config [ worker_id ] . state != WAIT ) goto finish ; lcore_config [ worker_id ] . f = f ; lcore_config [ worker_id ] . arg = arg ; n = 0 ; while ( n == 0 || ( n < 0 && errno == EINTR ) ) n = write ( m2w , & c , 1 ) ; if ( n < 0 ) rte_panic ( " \n " ) ; do { n = read ( w2m , & c , 1 ) ; } while ( n < 0 && errno == EINTR ) ; if ( n <= 0 ) rte_panic ( " \n " ) ; rc = 0 ; finish : rte_eal_trace_thread_remote_launch ( f , arg , worker_id , rc ) ; return rc ; }
Send a message to a worker lcore identified by worker_id to call a
 function f with argument arg.
Send a message to a worker lcore identified by worker_id to call a function f with argument arg .
/* send message */ /* wait ack */