sock_init_udp(&tp->sock);
}
+static int
+objectEntryInit(ObjectEntry *oe)
+{
+ pthread_condattr_t attr;
+
+ pthread_condattr_init(&attr);
+#if defined HAVE_PTHREAD_CONDATTR_SETCLOCK && HAVE_DECL_CLOCK_MONOTONIC
+ if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0)
+ return -1;
+#endif
+ ObjectEntryHID_init_root_field(oe);
+ pthread_rwlock_init(&oe->objRootLock, NULL);
+ htimerRoot_init_queue(oe);
+ pthread_rwlock_init(&oe->htimRootLock, NULL);
+ pthread_cond_init(&oe->htimSendCond, &attr);
+ pthread_mutex_init(&oe->htimSendMutex, NULL);
+ oe->htimSendCondValue = 0;
+ oe->htimNeedWakeUp = ORTE_TRUE;
+ return 0;
+}
+
ORTEDomain *
ORTEDomainCreate(int domain, ORTEDomainProp *prop,
ORTEDomainAppEvents *events, Boolean manager)
int i;
uint16_t port = 0;
int errno_save = 0;
- pthread_condattr_t attr;
debug(30, 2) ("ORTEDomainCreate: %s compiled: %s,%s\n",
ORTE_PACKAGE_STRING, __DATE__, __TIME__);
assert(d->taskSend.mb.cdrCodec.wptr_max <= d->taskSend.mb.cdrCodec.buf_len);
d->taskSend.mb.cdrCodec.data_endian = FLAG_ENDIANNESS;
- //init structure objectEntry
- pthread_condattr_init(&attr);
-#if defined HAVE_PTHREAD_CONDATTR_SETCLOCK && HAVE_DECL_CLOCK_MONOTONIC
- if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0)
- goto err_free;
-#endif
- ObjectEntryHID_init_root_field(&d->objectEntry);
- pthread_rwlock_init(&d->objectEntry.objRootLock, NULL);
- htimerRoot_init_queue(&d->objectEntry);
- pthread_rwlock_init(&d->objectEntry.htimRootLock, NULL);
- pthread_cond_init(&d->objectEntry.htimSendCond, &attr);
- pthread_mutex_init(&d->objectEntry.htimSendMutex, NULL);
- d->objectEntry.htimSendCondValue = 0;
- d->objectEntry.htimNeedWakeUp = ORTE_TRUE;
+ if (objectEntryInit(&d->objectEntry) == -1)
+ goto err_sock;
+
//publication,subscriptions
d->publications.counter = d->subscriptions.counter = 0;
CSTWriter_init_root_field(&d->publications);
pthread_mutex_destroy(&d->objectEntry.htimSendMutex);
pthread_rwlock_destroy(&d->objectEntry.htimRootLock);
pthread_rwlock_destroy(&d->objectEntry.objRootLock);
-err_free:
FREE(d);
errno = errno_save;
return NULL;