("ipfix_lock_mutex failed: Exporter is NULL!\n");
DPRINTF("ipfix_lock_mutex failed: Exporter is NULL!\n");
int ipfix_lock_mutex(ipfix_exporter* exporter, enum ipfix_lock_target target) {#ifdef IPFIX_THREADED	int ret = 0;	int success = FALSE;	pthread_mutex_t* my_mutex;	// is our exporter possibly invalid?	if (exporter == NULL) {		("ipfix_lock_mutex failed: Exporter is NULL!\n");		return -1;	}	/* determine our mutex: */	switch (target){	case EXPORTER:		// printf ("TARGET: Exporter\n");		my_mutex = &exporter-> exporter_mutex;		break;				case DATA:		my_mutex = &exporter-> data_sendbuffer_mutex;		break;	case TEMPLATE:		my_mutex = &exporter-> template_sendbuffer_mutex;		break;	case COLLECTOR:		my_mutex = &exporter->  collector_array_mutex;		break;	default:		fprintf (stderr, "Ipfix_lock_mutex: invalid type %i!\n", target);		DPRINTF ("++++++++++++++++++++++++++++++++++++++++++\n");		return -1;	}		while (!success) { // success loop		// try to lock the exporter (superlock)		ret = pthread_mutex_lock( &(exporter->exporter_mutex));		if (ret !=0 ) {			fprintf (stderr, "ipfix_lock_mutex on exporter mutex failed!\n");			DPRINTF (" pthread_mutex_lock returned %i; Thread %i \n", ret,  pthread_self());					return -1;		}		DPRINTF ("Thread %i locked EXPORTER\n", pthread_self());		if (target == EXPORTER) {			// we have all we need!			return 0;		}		/* now, try to obtain our lock */		ret = pthread_mutex_trylock (my_mutex);		if (ret == 0 ) {			// we are successful			success = TRUE;			DPRINTF ("Locked mutex No. %i, Thread %i \n", target, pthread_self());		} else {			// check for serious error conditions:			if (errno == EINVAL) {				fprintf (stderr, "ipfix_lock_mutex: the mutex has not been properly initialized\n");				DPRINTF ("++++++++++++++++++++++++++++++++++++++++++\n");				// do not forget to unlock the exporter!			}					}		// unlock the exporter again:		ret = pthread_mutex_unlock(&(exporter->exporter_mutex));		if (ret !=0 ) {			fprintf (stderr, "ipfix_lock_mutex unlocking exporter mutex failed!\n");			DPRINTF ("pthread_mutex_unlock returned %i, Thread %i \n", ret, pthread_self() );			return -1;		}		DPRINTF ("Thread %i unlocked EXPORTER\n", pthread_self());	} // end loop#else	// we may just as well check, if the exporter is valid:	if (exporter == NULL) {		DPRINTF ("ipfix_lock_mutex failed: Exporter is NULL!\n");		return -1;	}#endif	return 0;}