Esempio n. 1
0
static void *brussels_fn(void *v)
{
  char *brussels_name __attribute__((unused)) = "Brussels";
  make_error ("called from Brussels");
  loopt1 = 1;
  while (! (loopt1 && loopt2 && loopmain))
    loopt1++;
  loops (&loopt1);
  return NULL;
}
Esempio n. 2
0
static void *london_fn(void *v)
{
  char *london_name __attribute__((unused)) = "London";
  make_error ("called from London");
  loopt2 = 1;
  while (! (loopt1 && loopt2 && loopmain))
    loopt2++;
  loops (&loopt2);
  sleep(10);
  return NULL;
}
Esempio n. 3
0
int main(int argc, char** argv) {


        int menuNum;
      


        printf("1 = IF Statement:PH Level | 2 = Loops:Fibonacci Series| 3 = Array:Temperature| 4 = Methods:Number to Words ");
        printf("Please enter a number for what you would like to see:");
        scanf( "%d", & menuNum);


      
        if (menuNum == 1) {
            ifStatement();
        } else if(menuNum == 2){
           loops();
        } else if(menuNum == 3){
           arrays();
        } else if(menuNum == 4){

                methods();
               
}

void ifStatement(){

    //Variables
        double pH;
        
        printf("Acid Rain\n");
        printf("Acid Rain is an enviromentmatal problem. This program determines if the pH level in water is safe for fish.");


        printf(" \nEnter pH level:");
        scanf( "%d", & pH);
        
        
         if( pH < 0 | pH > 14 ) {
            printf( "ERROR");
        }
        else if(pH < 6.5) {
            printf("TOO ACIDIC - FISH IN STREAMS, RIVERS AND LAKES WILL NOT SURVIVE.");
        } else if (pH > 7.5) {
            printf("TOO ALKALINE - FISH IN STREAMS, RIVERS AND LAKES WILL NOT SURVIVE");
        } else {
            printf("NEUTRAL - FISH IN STREAMS, RIVERS AND LAKES WILL SURVIVE.");
        }

}
QAbstractAnimationJob* QSGSequentialAnimation::transition(QQuickStateActions &actions,
                        QQmlProperties &modified,
                        TransitionDirection direction,
                        QObject *defaultTarget)
{
    if (!isRunning())
        m_transitionRunning = true;

    prepareTransition(actions, modified, direction, defaultTarget);

    QPauseAnimationJob *job = new QPauseAnimationJob();
    job->setLoopCount(loops());
    job->setDuration(-1);
    return job;
}
Esempio n. 5
0
int main(int argc, char ** argv)
{
    int pmode, i, j;

    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &pmode);
    if (pmode != MPI_THREAD_MULTIPLE) {
        fprintf(stderr, "Thread Multiple not supported by the MPI implementation\n");
        MPI_Abort(MPI_COMM_WORLD, -1);
    }

    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    if (getenv("MPITEST_VERBOSE"))
        verbose = 1;

    /* For communication, we need an even number of processes */
    if (size % 2) {
        fprintf(stderr, "This test needs an even number of processes\n");
        MPI_Abort(MPI_COMM_WORLD, -1);
    }

    /* PROC_NULL */
    for (i = 0; i < MAX_THREADS; i++) {
        tp[i].thread_id = i;
        tp[i].use_proc_null = 1;
        tp[i].use_blocking_comm = 1;
        tp[i].msg_size = 0;
    }
    if (!rank && verbose) {
        printf("\nUsing MPI_PROC_NULL\n");
        printf("-------------------\n");
    }
    loops();

    /* Blocking communication */
    for (j = 0; j < MAX_MSG_SIZE; j = (!j ? 1 : j * HOP)) {
        for (i = 0; i < MAX_THREADS; i++) {
            tp[i].thread_id = i;
            tp[i].use_proc_null = 0;
            tp[i].use_blocking_comm = 1;
            tp[i].msg_size = j;
        }
        if (!rank && verbose) {
            printf("\nBlocking communication with message size %6d bytes\n", j);
            printf("------------------------------------------------------\n");
        }
        loops();
    }

    /* Non-blocking communication */
    for (j = 0; j < MAX_MSG_SIZE; j = (!j ? 1 : j * HOP)) {
        for (i = 0; i < MAX_THREADS; i++) {
            tp[i].thread_id = i;
            tp[i].use_proc_null = 0;
            tp[i].use_blocking_comm = 0;
            tp[i].msg_size = j;
        }
        if (!rank && verbose) {
            printf("\nNon-blocking communication with message size %6d bytes\n", j);
            printf("----------------------------------------------------------\n");
        }
        loops();
    }

    if (rank == 0) {
	printf( " No Errors\n" );
    }

    MPI_Finalize();

    return 0;
}