File: pth_create_0.c

package info (click to toggle)
massivethreads 1.02-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,924 kB
  • sloc: ansic: 27,814; sh: 4,559; cpp: 3,334; javascript: 1,799; makefile: 1,745; python: 523; asm: 373; perl: 118; lisp: 9
file content (25 lines) | stat: -rw-r--r-- 395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#include <pthread.h>

void * f(void * x) {
  return (void *)((size_t)x + 34);
}

int main() {
  void * ret[1];
  pthread_t th;
  int r = pthread_create(&th, 0, f, (void *)12);
  assert(r == 0);
  pthread_join(th, ret);
  if (ret[0] == (void *)46) {
    printf("OK\n");
    return 0;
  } else {
    printf("NG\n");
    return 1;
  }
}