~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to src/netsys/configtests/posix_pthread.c

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <errno.h>
 
2
#include <unistd.h>
 
3
#include <pthread.h>
 
4
#include <stdio.h>
 
5
 
 
6
#include "caml/mlvalues.h"
 
7
#include "caml/alloc.h"
 
8
 
 
9
 
 
10
static void *thread_main(void *arg) {
 
11
    pthread_exit(NULL);
 
12
}
 
13
 
 
14
 
 
15
/* reminder: we return the exit code, and 0 means success */
 
16
 
 
17
value check(value dummy) {
 
18
    pthread_t thr;
 
19
    int code;
 
20
 
 
21
    code = pthread_create(&thr, NULL, thread_main, NULL);
 
22
    if (code != 0) return Val_int(1);
 
23
 
 
24
    code = pthread_join(thr, NULL);
 
25
    if (code != 0) return Val_int(1);
 
26
 
 
27
    return Val_int(0);
 
28
}