Ejemplo n.º 1
0
static void *
LeafThread (void *_thread)
{
	portal_t   *portal;
	int         thread = (int) (intptr_t) _thread;

	do {
		portal = GetNextPortal ();
		if (!portal)
			break;

		if (working)
			working[thread] = (int) (portal - portals);
		PortalFlow (portal);

		if (options.verbosity > 0)
			printf ("portal:%4i  mightsee:%4i  cansee:%4i\n",
						(int) (portal - portals),
						portal->nummightsee,
						portal->numcansee);
	} while (1);

	printf ("thread %d done\n", thread);
	if (working)
		working[thread] = -1;
	return NULL;
}
Ejemplo n.º 2
0
Archivo: vis.c Proyecto: qbism/super8
/*
==============
LeafThread
==============
*/
void *LeafThread (int thread)
{
    time_t oldtime, newtime;
    portal_t *p;

//printf ("Begining LeafThread: %i\n",(int)thread);
    oldtime = time(NULL);
    do
    {
        p = GetNextPortal ();
        if (!p)
            break;

        PortalFlow (p);

        portalschecked++;
        if (verbose)
            printf ("portal %4i of %4i mightsee:%4i  cansee:%4i\n", (int) portalschecked, (int) numportals * 2, (int) p->nummightsee, (int) p->numcansee);
        else
        {
            newtime = time(NULL);
            if (newtime != oldtime)
            {
                printf("\rportal %4i of %4i (%3i%%), estimated time left: %4i seconds    \b\b\b\b", (int) portalschecked, (int) numportals * 2, (int) (portalschecked*100/(numportals*2)), (int) ((numportals*2-portalschecked)*(newtime-portalizestarttime)/portalschecked));
                fflush(stdout);
                oldtime = newtime;
            }
        }
    } while (1);
    printf("\n");

//printf ("Completed LeafThread: %i\n",(int)thread);

    return NULL;
}
Ejemplo n.º 3
0
/*
  ==============
  LeafThread
  ==============
*/
void *
LeafThread(void *arg)
{
    double now;
    portal_t *p;

    do {
        ThreadLock();
        /* Save state if sufficient time has elapsed */
        now = I_FloatTime();
        if (now > statetime + stateinterval) {
            statetime = now;
            SaveVisState();
        }
        ThreadUnlock();

        p = GetNextPortal();
        if (!p)
            break;

        PortalFlow(p);

        PortalCompleted(p);

        if (verbose > 1) {
            logprint("portal:%4i  mightsee:%4i  cansee:%4i\n",
                     (int)(p - portals), p->nummightsee, p->numcansee);
        }
    } while (1);

    return NULL;
}
Ejemplo n.º 4
0
/*
==============
LeafThread
==============
*/
void LeafThread (int thread)
{
	portal_t	*p;
		
	do
	{
		p = GetNextPortal ();
		if (!p)
			break;
			
		PortalFlow (p);
		
		qprintf ("portal:%4i  mightsee:%4i  cansee:%4i\n", (int)(p - portals), p->nummightsee, p->numcansee);
	} while (1);
}
Ejemplo n.º 5
0
void ProcessPortalFlow( int iThread, uint64 iPortal, MessageBuffer *pBuf )
{
	// Process Portal and distribute results
	CTimeAdder adder( &g_CPUTime );

	PortalFlow( iThread, iPortal );

	// Send my result to root and potentially the other slaves
	// The slave results are read in RecursiveLeafFlow
	//
	if ( pBuf )
	{
		portal_t * p = sorted_portals[iPortal];
		pBuf->write( p->portalvis, portalbytes );
	}
}
Ejemplo n.º 6
0
void *LeafThread (int thread)
#endif
{
	portal_t	*p;
		
//printf ("Begining LeafThread: %i\n",(int)thread);	
	do
	{
		p = GetNextPortal ();
		if (!p)
			break;
			
		PortalFlow (p);
		
		if (verbose)
			printf ("portal:%4i  mightsee:%4i  cansee:%4i\n", (int)(p - portals), p->nummightsee, p->numcansee);
	} while (1);

//printf ("Completed LeafThread: %i\n",(int)thread);	

	return NULL;
}
Ejemplo n.º 7
0
void *LeafThread (int thread)
#endif
{
	portal_t	*p;
		
//printf ("Beginning LeafThread: %i\n",(int)thread);	
	do
	{
        //Get the portal with the least number of leafs that might be visible.
		p = GetNextPortal ();
		if (!p)
			break;
			
		PortalFlow (p);
		
		if (verbose)
			printf ("portal:%4i  mightsee:%4i  cansee:%4i\n", (int)(p - portals), p->nummightsee, p->numcansee);
	} while (1);

//printf ("Completed LeafThread: %i\n",(int)thread);	

	return NULL;
}