brintos

brintos / llvm-project-archived public Read only

0
0
Text · 934 B · b260ce4 Raw
41 lines · c
1// RUN: %libomp-compile && env OMP_WAIT_POLICY=active %libomp-run active2// RUN: %libomp-compile && env OMP_WAIT_POLICY=passive %libomp-run passive3//4// OMP_WAIT_POLICY=active should imply blocktime == INT_MAX5// i.e., threads spin-wait forever6// OMP_WAIT_POLICY=passive should imply blocktime == 07// i.e., threads immediately sleep8#include <stdio.h>9#include <string.h>10#include <limits.h>11#include "omp_testsuite.h"12 13void usage() {14    fprintf(stderr, "usage: omp_wait_policy active|passive\n");15}16 17int main(int argc, char** argv)18{19  int blocktime, retval=1;20  const char* env_var_value;21 22  if (argc != 2) {23    usage();24    return 1;25  }26 27  blocktime = kmp_get_blocktime();28 29  env_var_value = argv[1];30  if (!strcmp(env_var_value, "active")) {31    retval = (blocktime != INT_MAX);32  } else if (!strcmp(env_var_value, "passive")) {33    retval = (blocktime != 0);34  } else {35    usage();36    retval = 1;37  }38 39  return retval;40}41