/* ================== CalcPortalVis ================== */ void CalcPortalVis (void) { int i; // fastvis just uses mightsee for a very loose bound if (fastvis) { for (i=0 ; i<numportals*2 ; i++) { portals[i].visbits = portals[i].mightsee; portals[i].status = stat_done; } return; } portalizestarttime = time(NULL); LeafThread (0); if (verbose) { printf ("portalcheck: %i portaltest: %i portalpass: %i\n",c_portalcheck, c_portaltest, c_portalpass); printf ("c_vistest: %i c_mighttest: %i\n",c_vistest, c_mighttest); } }
/* ================== CalcPortalVis ================== */ void CalcPortalVis (void) { int i; // fastvis just uses mightsee for a very loose bound if (fastvis) { for (i=0 ; i<numportals*2 ; i++) { portals[i].visbits = portals[i].mightsee; portals[i].status = stat_done; } return; } leafon = 0; #if defined(__alpha) || defined(__APPLE__) { pthread_t work_threads[MAX_THREADS]; int i; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER ; my_mutex = &mutex; for (i=0 ; i<numthreads ; i++) { if (pthread_create(&work_threads[i], NULL, LeafThread, NULL)) Error ("pthread_create failed"); } for (i=0 ; i<numthreads ; i++) { if (pthread_join (work_threads[i], NULL) == -1) Error ("pthread_join failed"); } if (pthread_mutex_destroy (my_mutex) == -1) Error ("pthread_mutex_destroy failed"); } #else LeafThread (0); #endif if (verbose) { printf ("portalcheck: %i portaltest: %i portalpass: %i\n",c_portalcheck, c_portaltest, c_portalpass); printf ("c_vistest: %i c_mighttest: %i\n",c_vistest, c_mighttest); } }
/* ================== CalcPortalVis ================== */ void CalcPortalVis (void) { int i; // fastvis just uses mightsee for a very loose bound if (fastvis) { for (i=0 ; i<numportals*2 ; i++) { portals[i].visbits = portals[i].mightsee; portals[i].status = stat_done; } return; } leafon = 0; #ifdef __alpha { pthread_t work_threads[MAX_THREADS]; pthread_addr_t status; pthread_attr_t attrib; pthread_mutexattr_t mattrib; int i; my_mutex = malloc (sizeof(*my_mutex)); if (pthread_mutexattr_create (&mattrib) == -1) Error ("pthread_mutex_attr_create failed"); if (pthread_mutexattr_setkind_np (&mattrib, MUTEX_FAST_NP) == -1) Error ("pthread_mutexattr_setkind_np failed"); if (pthread_mutex_init (my_mutex, mattrib) == -1) Error ("pthread_mutex_init failed"); if (pthread_attr_create (&attrib) == -1) Error ("pthread_attr_create failed"); if (pthread_attr_setstacksize (&attrib, 0x100000) == -1) Error ("pthread_attr_setstacksize failed"); for (i=0 ; i<numthreads ; i++) { if (pthread_create(&work_threads[i], attrib , LeafThread, (pthread_addr_t)i) == -1) Error ("pthread_create failed"); } for (i=0 ; i<numthreads ; i++) { if (pthread_join (work_threads[i], &status) == -1) Error ("pthread_join failed"); } if (pthread_mutex_destroy (my_mutex) == -1) Error ("pthread_mutex_destroy failed"); } #else LeafThread (0); #endif if (verbose) { printf ("portalcheck: %i portaltest: %i portalpass: %i\n",c_portalcheck, c_portaltest, c_portalpass); printf ("c_vistest: %i c_mighttest: %i\n",c_vistest, c_mighttest); } }
static void CalcPortalVis (void) { long i; // fastvis just uses mightsee for a very loose bound if (options.minimal) { for (i = 0; i < numportals * 2; i++) { portals[i].visbits = portals[i].mightsee; portals[i].status = stat_done; } return; } #if defined (HAVE_PTHREAD_H) && defined (HAVE_PTHREAD) { pthread_t work_threads[MAX_THREADS + 1]; void *status; pthread_attr_t attrib; if (options.threads > 1) { working = calloc (options.threads, sizeof (int)); my_mutex = malloc (sizeof (*my_mutex)); if (pthread_mutex_init (my_mutex, 0) == -1) Sys_Error ("pthread_mutex_init failed"); if (pthread_attr_init (&attrib) == -1) Sys_Error ("pthread_attr_create failed"); if (pthread_attr_setstacksize (&attrib, 0x100000) == -1) Sys_Error ("pthread_attr_setstacksize failed"); for (i = 0; i < options.threads; i++) { if (pthread_create (&work_threads[i], &attrib, LeafThread, (void *) (intptr_t) i) == -1) Sys_Error ("pthread_create failed"); } if (pthread_create (&work_threads[i], &attrib, WatchThread, (void *) (intptr_t) i) == -1) Sys_Error ("pthread_create failed"); for (i = 0; i < options.threads; i++) { if (pthread_join (work_threads[i], &status) == -1) Sys_Error ("pthread_join failed"); } if (pthread_join (work_threads[i], &status) == -1) Sys_Error ("pthread_join failed"); if (pthread_mutex_destroy (my_mutex) == -1) Sys_Error ("pthread_mutex_destroy failed"); } else { LeafThread (0); } } #else LeafThread (0); #endif if (options.verbosity > 0) { printf ("portalcheck: %i portaltest: %i portalpass: %i\n", c_portalcheck, c_portaltest, c_portalpass); printf ("c_vistest: %i c_mighttest: %i\n", c_vistest, c_mighttest); } }