[][src]Function winping::set_async_buffer_size

pub unsafe fn set_async_buffer_size(size: usize)

This function can be used to to set the size of the inter-thread buffer used for AsyncPinger. This buffer is specifically used for sending jobs (ping requests) to the thread which handles the async IO (as described in docs for AsyncPinger::new). As such, this is a a variable which, if used, must be set prior to creating an AsyncPinger, and once set it will override any compile-time value (which can be set by defining a compile-time environment variable named WINPING_ASYNC_BUFFER_SIZE). If neither the compile-time nor the run-time values are set, AsyncPinger falls back on a default value of 1024.

Note that if the compile-time environment variable is set and cannot be parsed, this will result in a run-time panic the first time an AsyncPinger is created!

Safety

It is unsafe to set this variable because it is global and mutable with no protection against data races. If you set this variable, it MUST be done prior to creating any AsyncPinger.