void plc_inittimer ( plc_sThread *tp ) { #if 0 /* Create the timer mutex */ #ifdef OS_ELN { int sts; ELN$CREATE_MUTEX(tp->timer_mutex, &sts); if (EVEN(sts)) pwr_Bugcheck(sts, "Cannot create timer_mutex"); } #elif defined OS_POSIX { pthread_mutexattr_t attr; pthread_mutexattr_create(&attr); if (pthread_mutex_init(&tp->timer_mutex, attr) == -1) pwr_Bugcheck(errno, "Cannot create timer_mutex"); pthread_mutexattr_delete(&attr); } #endif #endif }
int main (int argc, char *argv[]) { pwr_tStatus sts = 1; qdb_sPort port; qdb_sPort *pp; qcom_sQid qid = qdb_cQimport; qdb_sNode *np; errh_Init("pwr_qimp"); if (!qcom_Init(&sts, NULL)) exit(sts); if (!qcom_CreateQ(&sts, &qid, NULL)) exit(sts); port.sa.sin_family = AF_INET; port.sa.sin_addr.s_addr = htonl(INADDR_ANY); port.sa.sin_port = qdb->my_node->sa.sin_port; pp = qnet_Open(&sts, &port); while (qdb->g->up) { np = qnet_Get(&sts, pp); if (np->bp == NULL) pwr_Bugcheck(QCOM__WEIRD, "(np->bp == NULL)"); linkEvent(pp, np); } qnet_Close(&sts, pp); qcom_Exit(&sts); exit(QCOM__SUCCESS); }