X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vlib%2Fvlib%2Fvlib_process_doc.h;h=a47c5e4bbe438d795a68cf3de43cd713a999e9f2;hb=f5984bde0462f21402ba5c2c3ad04e44440402eb;hp=953eb0c459de80dcd69982b5724fdfbd34818e3a;hpb=2ab470a77fe73548c1d7f6a0d18ed51fbdba36b4;p=vpp.git diff --git a/vlib/vlib/vlib_process_doc.h b/vlib/vlib/vlib_process_doc.h index 953eb0c459d..a47c5e4bbe4 100644 --- a/vlib/vlib/vlib_process_doc.h +++ b/vlib/vlib/vlib_process_doc.h @@ -57,11 +57,11 @@ Here's an example: -
- #define EXAMPLE_POLL_PERIOD 10.0
+
+ \#define EXAMPLE_POLL_PERIOD 10.0
static uword
- example_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
+ example_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
{
f64 poll_time_remaining;
@@ -72,8 +72,8 @@
{
int i;
- // Sleep until next periodic call due,
- // or until we receive event(s)
+ // Sleep until next periodic call due,
+ // or until we receive event(s)
//
poll_time_remaining =
vlib_process_wait_for_event_or_clock (vm, poll_time_remaining);
@@ -94,33 +94,33 @@
handle_event2 (vm, event_data[i]);
break;
- // ... and so forth for each event type
+ // ... and so forth for each event type
default:
- // This should never happen...
- clib_warning ("BUG: unhandled event type %d",
+ // This should never happen...
+ clib_warning ("BUG: unhandled event type %d",
event_type);
break;
}
vec_reset_length (event_data);
- // Timer expired, call periodic function
+ // Timer expired, call periodic function
if (vlib_process_suspend_time_is_zero (poll_time_remaining))
{
example_periodic (vm);
poll_time_remaining = EXAMPLE_POLL_PERIOD;
}
}
- // NOTREACHED
+ // NOTREACHED
return 0;
- }
+ }
static VLIB_REGISTER_NODE (example_node) = {
.function = example_process,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "example-process",
};
-
+
In this example, the VLIB process node waits for an event to
occur, or for 10 seconds to elapse. The code demuxes on the event