~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to tests/thread_leak_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-03-02 13:43:18 UTC
  • mfrom: (1.2.5 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110302134318-82ful0us5ce82qe8
Tags: 1:7.1-7
* Add ppc64 symbol file (Closes: #615469)
* Add sh4 symbol file (Closes: #614744)
* Add armhf symbol file
* Add powerpcspe symbol file
* Handle sparc64 the same as sparc
* Clear non-arch symbol file to support building on not yet captured
  architectures
* add -pthread to fix build with --no-add-needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define GC_LINUX_THREADS
 
1
#ifndef GC_THREADS
 
2
#  define GC_THREADS
 
3
#endif /* GC_THREADS */
2
4
#include "leak_detector.h"
3
5
#include <pthread.h>
4
6
#include <stdio.h>
15
17
    for (i = 1; i < 10; ++i) {
16
18
        free(p[i]);
17
19
    }
 
20
    return 0;
18
21
}       
19
22
 
20
23
#define NTHREADS 5
24
27
    pthread_t t[NTHREADS];
25
28
    int code;
26
29
 
 
30
    GC_INIT();
27
31
    for (i = 0; i < NTHREADS; ++i) {
28
32
        if ((code = pthread_create(t + i, 0, test, 0)) != 0) {
29
33
            printf("Thread creation failed %d\n", code);
37
41
    CHECK_LEAKS();
38
42
    CHECK_LEAKS();
39
43
    CHECK_LEAKS();
 
44
    return 0;
40
45
}