dispatch_set_hash_size()

QNX SDP8.0C Library ReferenceAPIDeveloper

Set the hash table size

Synopsis:

#include <sys/dispatch.h>

int dispatch_set_hash_size( dispatch_t *dpp, 
                            unsigned size );

Arguments:

dpp
A dispatch handle created by a successful call to dispatch_create() or dispatch_create_channel().
size
The hash table size value to set.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

This function sets the hash table size of a dispatch_t structure to the specified value.

The resource manager framework uses a hash table to resolve client requests to corresponding binding entries. A binding entry contains the OCB and I/O functions for the client's file descriptor.

The default hash table size is 1024 entries, with each entry taking up 16 bytes, for a total memory usage of 16 KB.

Hash collisions are resolved using a linear search through the list of binding entries in the corresponding bucket.

You can balance memory usage against hash collision frequency by adjusting the hash table size. If a resource manager expects a large number of concurrently active file descriptors, then increase the table size accordingly. Conversely, if your resource manager has few clients, then downsize to reduce memory footprint. The default size provides minimal hash collisions for servers with medium-to-large client numbers.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EINVAL
The dispatch handle, dpp, is invalid.

Classification:

QNX OS

Safety:
Cancellation point No
Signal handler No
Thread Yes
Page updated: