_NutDisableNuTC(), _NutEnableNuTC()

create or remove appropriate structures for NuTCRACKER Platform code 

Function


SYNOPSIS

<winnutc.h>

void _NutDisableNuTC(void);

void _NutEnableNuTC(sigset_t *sigmask);


DESCRIPTION

The _NutEnableNuTC() function is used in combination with _NutDisableNuTC() to create callback interfaces in a NuTCRACKER Platform application or DLL which allow threads not created by the NuTCRACKER Platform to call NuTCRACKER Platform code. The _NutEnableNuTC() function creates the appropriate structures for executing NuTCRACKER Platform code, and the _NutDisableNuTC() function undoes this action.

These functions are actually implemented as C pre-processor macros, in a form that ensures they are correctly matched. If the functions are not correctly paired, the code fails to compile. This prevents the function from exiting without removing the structures created by _NutEnableNuTC(). See EXAMPLES for more details.


PARAMETERS

sigmask 

Specifies the signal mask to establish when the NuTCRACKER Platform data structures are created. A NULL value results in an empty signal mask. Specifying a signal mask is useful when asynchronous signals are being handled in the background by other NuTCRACKER Platform threads, as an empty signal mask could cause a signal to be delivered to this newly-attached thread when it is not expecting one.


RETURN VALUES

None.


CONFORMANCE

MKS Toolkit UNIX APIs extension.


EXAMPLES

Given the following function:

func1(void *arg1, struct s *arg2, double arg3) {
	...
}

To expose this function from a standalone NuTCRACKER Platform DLL (one usable independent of a NuTCRACKER Platform application), you would change it as follows:

func1(void *arg1, struct s *arg2, double arg3) {
	#ifdef __NUTC__
	_NutEnableNuTC(NULL);
	#endif
	...
	#ifdef __NUTC__
	_NutDisableNuTC()
	#endif
}

MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Refer to Calling Back Into NuTCRACKER from Win32 Code in the The Porting Process chapter of the MKS Toolkit UNIX to Windows Porting Guide for detailed information on the use of this function.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


MKS Toolkit 9.3 Documentation Build 6.