F.2.4. rascal_set_option

This function can be used for fine-tuning the library. Fine-tuning is done by changing so-called "options", each of which is has a 32-bit signed integer value assigned to it.

rrid_t rascal_set_option(
	unsigned int optid,
	long int value,
	long int *old_value OPTIONAL
);

Parameters. 

optid

Identifies the option that the application wants changed. Possible options are:

  • RO_VOID – no meaning, holds a user-defined 32-bit value.

  • RO_DNS_TIMEOUT – the number of milliseconds for a DNS query to remain unanswered before being resent.

  • RO_DNS_RETRY – the number of times an unanswered DNS query is resent before a failure is reported. Setting this to zero will disable retries, having the queries only sent once.

  • RO_THREAD_POLICY – threading policy used by the library. The value can only be set once and is set by the rascal_init function. Once the option is set, it becomes read-only. If you change this option before initializing the library with a call to rascal_init, the library will fail to initialize and normal execution will not be possible.

  • RO_CONN_TIMEOUT — outgoing connection timeout, in seconds. Connection attempts that do not finish during the specified time period will fail with REC_CONN_TIMEOUT.

value

The new value for the option. The library performs no sanity check of the values.

old_value

If not null, receives the old value of the option.

Return value. 

On success, the function returns REC_SUCCESS. If the option can not be changed, REC_OPTION_READONLY is returned. Otherwise, an error code is returned which can then be used in a call to rascal_get_errmsg.

Remarks. 

The options are process-wide. The changes are immediately visible to all threads.