return ContactQuorum_rcode(okcalls, rcode);
}
+#if defined(AFS_PTHREAD_ENV)
+static int
+ubik_thread_create(pthread_attr_t *tattr, pthread_t *thread, void *proc) {
+ osi_Assert(pthread_attr_init(tattr) == 0);
+ osi_Assert(pthread_attr_setdetachstate(tattr, PTHREAD_CREATE_DETACHED) == 0);
+ osi_Assert(pthread_create(thread, tattr, proc, NULL) == 0);
+ return 0;
+}
+#endif
/*!
* \brief This routine initializes the ubik system for a set of servers.
udisk_Init(ubik_nBuffers);
ulock_Init();
+ code = uvote_Init();
+ if (code)
+ return code;
+ code = urecovery_Initialize(tdb);
+ if (code)
+ return code;
+ if (info)
+ code = ubeacon_InitServerListByInfo(myHost, info, clones);
+ else
+ code = ubeacon_InitServerList(myHost, serverList);
+ if (code)
+ return code;
+
ubik_callPortal = myPort;
/* try to get an additional security object */
ubik_sc[0] = rxnull_NewServerSecurityObject();
}
/* for backwards compat this should keep working as it does now
and not host bind */
-#if 0
- /* This really needs to be up above, where I have put it. It works
- * here when we're non-pthreaded, but the code above, when using
- * pthreads may (and almost certainly does) end up calling on a
- * pthread resource which gets initialized by rx_Init. The end
- * result is that an assert fails and the program dies. -- klm
- */
- code = rx_Init(myPort);
- if (code < 0)
- return code;
-#endif
tservice =
rx_NewService(0, VOTE_SERVICE_ID, "VOTE", ubik_sc, 3,
* the "steplock" problem in ubik initialization. Defect 11037.
*/
#ifdef AFS_PTHREAD_ENV
-/* do assert stuff */
- osi_Assert(pthread_attr_init(&rxServer_tattr) == 0);
- osi_Assert(pthread_attr_setdetachstate(&rxServer_tattr, PTHREAD_CREATE_DETACHED) == 0);
-/* osi_Assert(pthread_attr_setstacksize(&rxServer_tattr, rx_stackSize) == 0); */
-
- osi_Assert(pthread_create(&rxServerThread, &rxServer_tattr, (void *)rx_ServerProc, NULL) == 0);
+ ubik_thread_create(&rxServer_tattr, &rxServerThread, (void *)rx_ServerProc);
#else
LWP_CreateProcess(rx_ServerProc, rx_stackSize, RX_PROCESS_PRIORITY,
NULL, "rx_ServerProc", &junk);
#endif
- /* do basic initialization */
- code = uvote_Init();
- if (code)
- return code;
- code = urecovery_Initialize(tdb);
- if (code)
- return code;
- if (info)
- code = ubeacon_InitServerListByInfo(myHost, info, clones);
- else
- code = ubeacon_InitServerList(myHost, serverList);
- if (code)
- return code;
-
/* now start up async processes */
#ifdef AFS_PTHREAD_ENV
-/* do assert stuff */
- osi_Assert(pthread_attr_init(&ubeacon_Interact_tattr) == 0);
- osi_Assert(pthread_attr_setdetachstate(&ubeacon_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0);
-/* osi_Assert(pthread_attr_setstacksize(&ubeacon_Interact_tattr, 16384) == 0); */
- /* need another attr set here for priority??? - klm */
-
- osi_Assert(pthread_create(&ubeacon_InteractThread, &ubeacon_Interact_tattr,
- (void *)ubeacon_Interact, NULL) == 0);
+ ubik_thread_create(&ubeacon_Interact_tattr, &ubeacon_InteractThread,
+ (void *)ubeacon_Interact);
#else
code = LWP_CreateProcess(ubeacon_Interact, 16384 /*8192 */ ,
LWP_MAX_PRIORITY - 1, (void *)0, "beacon",
#endif
#ifdef AFS_PTHREAD_ENV
-/* do assert stuff */
- osi_Assert(pthread_attr_init(&urecovery_Interact_tattr) == 0);
- osi_Assert(pthread_attr_setdetachstate(&urecovery_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0);
-/* osi_Assert(pthread_attr_setstacksize(&urecovery_Interact_tattr, 16384) == 0); */
- /* need another attr set here for priority??? - klm */
-
- osi_Assert(pthread_create(&urecovery_InteractThread, &urecovery_Interact_tattr,
- (void *)urecovery_Interact, NULL) == 0);
-
+ ubik_thread_create(&urecovery_Interact_tattr, &urecovery_InteractThread,
+ (void *)urecovery_Interact);
return 0; /* is this correct? - klm */
#else
code = LWP_CreateProcess(urecovery_Interact, 16384 /*8192 */ ,