example/generator/odp_generator.c
static int gen_recv_thread(void *arg)
{
	int thr;
	thread_args_t *thr_args;
	odp_packet_t pkts[MAX_RX_BURST];
	odp_event_t events[MAX_RX_BURST], ev;
	int pkt_cnt, ev_cnt, i;
	int burst_size;

	thr = odp_thread_id();
	thr_args = (thread_args_t *)arg;
	burst_size = args->rx_burst_size;

	printf("  [%02i] created mode: RECEIVE SCHEDULER\n", thr);
	odp_barrier_wait(&args->barrier);

	for (;;) {
		if (thr_args->stop)
			break;

		/* Use schedule to get buf from any input queue */
		ev_cnt = odp_schedule_multi(NULL, ODP_SCHED_NO_WAIT,
					    events, burst_size);
		if (ev_cnt == 0)
			continue;

		for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) {
			ev = events[i];

			if (odp_event_type(ev) == ODP_EVENT_PACKET)
				pkts[pkt_cnt++] = odp_packet_from_event(ev);
			else
				odp_event_free(ev);
		}

		if (pkt_cnt) {
			process_pkts(thr, thr_args, pkts, pkt_cnt);

			odp_packet_free_multi(pkts, pkt_cnt);
		}
	}

	return 0;
}
/**
 * Scheduler receive function
 *
 * @param arg  thread arguments of type 'thread_args_t *'
 */
Scheduler receive function
@param arg  thread arguments of type 'thread_args_t *'
Scheduler receive function @param arg thread arguments of type ' thread_args_t * '
static int gen_recv_thread(void *arg)
{
	int thr;
	thread_args_t *thr_args;
	odp_packet_t pkts[MAX_RX_BURST];
	odp_event_t events[MAX_RX_BURST], ev;
	int pkt_cnt, ev_cnt, i;
	int burst_size;
	thr = odp_thread_id();
	thr_args = (thread_args_t *)arg;
	burst_size = args->rx_burst_size;
	printf("  [%02i] created mode: RECEIVE SCHEDULER\n", thr);
	odp_barrier_wait(&args->barrier);
	for (;;) {
		if (thr_args->stop)
			break;
		ev_cnt = odp_schedule_multi(NULL, ODP_SCHED_NO_WAIT,
					    events, burst_size);
		if (ev_cnt == 0)
			continue;
		for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) {
			ev = events[i];
			if (odp_event_type(ev) == ODP_EVENT_PACKET)
				pkts[pkt_cnt++] = odp_packet_from_event(ev);
			else
				odp_event_free(ev);
		}
		if (pkt_cnt) {
			process_pkts(thr, thr_args, pkts, pkt_cnt);
			odp_packet_free_multi(pkts, pkt_cnt);
		}
	}
	return 0;
}
static int gen_recv_thread ( void * arg ) { int thr ; thread_args_t * thr_args ; odp_packet_t pkts [ MAX_RX_BURST ] ; odp_event_t events [ MAX_RX_BURST ] , ev ; int pkt_cnt , ev_cnt , i ; int burst_size ; thr = odp_thread_id ( ) ; thr_args = ( thread_args_t * ) arg ; burst_size = args -> rx_burst_size ; printf ( " \n " , thr ) ; odp_barrier_wait ( & args -> barrier ) ; for ( ; ; ) { if ( thr_args -> stop ) break ; ev_cnt = odp_schedule_multi ( NULL , ODP_SCHED_NO_WAIT , events , burst_size ) ; if ( ev_cnt == 0 ) continue ; for ( i = 0 , pkt_cnt = 0 ; i < ev_cnt ; i ++ ) { ev = events [ i ] ; if ( odp_event_type ( ev ) == ODP_EVENT_PACKET ) pkts [ pkt_cnt ++ ] = odp_packet_from_event ( ev ) ; else odp_event_free ( ev ) ; } if ( pkt_cnt ) { process_pkts ( thr , thr_args , pkts , pkt_cnt ) ; odp_packet_free_multi ( pkts , pkt_cnt ) ; } } return 0 ; }
Scheduler receive function
 @param arg  thread arguments of type 'thread_args_t *'
Scheduler receive function @param arg thread arguments of type ' thread_args_t * '
/* Use schedule to get buf from any input queue */