Socket_poll documentation -- constants

Constants you pass to the socket_poll_cntl_opt() function

Constant: SOCKET_POLL_CNTL_OPT_GET_MAP_TYPE
Parameter[1]: value holder
Type[1]: struct Socket_poll_cntl_ret_int *
Explanation:

This option will get the value for the option _MAP_TYPE.

Currently this can either be SOCKET_POLL_TYPE_MAP_COMPRESSED or SOCKET_POLL_TYPE_MAP_DIRECT.

Note:

The value of this option is initially undefined, so if you _need_ a certain type then you should call set with _MAP_TYPE.

Constant: SOCKET_POLL_CNTL_OPT_SET_MAP_TYPE
Parameter[1]: value
Type[1]: int
Explanation:

This option will set the value for the option flag _MAP_TYPE.

Currently this can either be SOCKET_POLL_TYPE_MAP_COMPRESSED or SOCKET_POLL_TYPE_MAP_DIRECT.

This is the flag which chooses whether the offsets returned from socket_poll_add() are directly related to the fd you pass in (Ie. they are fd + 1) or whether they are completely unrelated.

Each choice has it's pros and cons.

Directly mapped offsets are less CPU intensive on _add() and _del(), but can be more memory intensive and if they are are likely to be more CPU intensive on a call to _update_all().

Compressed mapped offsets work the other way, there is a CPU hit on _add() and _del() but they will use less memory.

Note:

If you want to do socket_poll_add() on an fd many times, then it's worth noting that if you use direct mapping then you can only do it 255 times (why you'd want to do it anywhere near this amount is beyond me) after which it will always fail. However if you wish to do it 255 times or less then direct mapping will always return the same offset and so use many times less memory.

Ie. If you do 4 socket_poll_add()'s per fd then compressed mapping will use 4 offsets and direct mapping will use 1.

However in the case of multiple fd's the reurn value from socket_poll_update_all() will be 1, not 4, in the above example.

Constant: SOCKET_POLL_CNTL_OPT_GET_MAP_COMPRESSED_GROW
Parameter[1]: value holder
Type[1]: struct Socket_poll_cntl_ret_size_t *
Explanation:

This option will get the value of the _MAP_COMPRESSED_GROW number.

Constant: SOCKET_POLL_CNTL_OPT_SET_MAP_COMPRESSED_GROW
Parameter[1]: value
Type[1]: size_t
Explanation:

This option will set the value of the _MAP_COMPRESSED_GROW number.

This number controls how much of a block to grow the mapping by when using compressed mapping (and you socket_poll needs to allocate at least one offset entry).

Constant: SOCKET_POLL_CNTL_OPT_GET_MAP_SIZE
Parameter[1]: value holder
Type[1]: struct Socket_poll_cntl_ret_size_t *
Explanation:

This option will get the value of the current size of the indicators array.

Constant: SOCKET_POLL_CNTL_OPT_SET_MAP_SIZE
Parameter[1]: value
Type[1]: size_t
Explanation:

This option will set the value of the indicators array (and hence realloc the array).

Constant: SOCKET_POLL_CNTL_OPT_GET_OVERLOAD_FUNC
Parameter[1]: value holder
Type[1]: struct Socket_poll_cntl_ret_func_ptr *
Explanation:

This option will get the function that will execute when you run socket_poll_update_overload().

Constant: SOCKET_POLL_CNTL_OPT_SET_OVERLOAD_FUNC
Parameter[1]: value holder
Type[1]: void (*)(int)
Explanation:

This option will set the function that will execute when you run socket_poll_update_overload().

Note:

This function will be called when socket_poll_update_overload() is called with the first argukent being the normal return value from socket_poll_update_all().

Constant: SOCKET_POLL_CNTL_OPT_GET_QUICK_POLL
Parameter[1]: Returns value of flag
Type[1]: int *
Explanation:

This options will get the value of flag that allows the socket_poll library to do a "quick poll" before the actual poll(). This can save a lot of time, and so is enabled by default.

Constant: SOCKET_POLL_CNTL_OPT_SET_QUICK_POLL
Parameter[1]: Value of flag
Type[1]: int
Explanation:

This options will set the value of flag that allows the socket_poll library to do a "quick poll" before the actual poll(). This can save a lot of time, so unless you really know what you are doing leave it set.