Example #1
0
int main(void) {
  pthread_t id1, id2;
  init_account(&A);
  init_account(&B);
  int i;
  for (i = 0; i < 100000; i++) {
    pthread_create(&id1, NULL, t1, NULL);
    pthread_create(&id2, NULL, t2, NULL);
    pthread_join (id1, NULL);
    pthread_join (id2, NULL);
    printf("%d: A = %d, B = %d.\n", i, A.balance, B.balance);
  }
  return 0;
}
Example #2
0
double test_malloc() {
  account *pa;
  init_account(&pa);
  return account_value(pa);
}
Example #3
0
void test_free_funptr() {
  account *pa;
  init_account(&pa);
  do_call(pa, &free);
}
Example #4
0
void test_malloc() {
  account *pa;
  init_account(&pa);
  
  ASSERT(account_value(pa) == 15000);
}