diff options
author | bje <bje> | 1998-07-22 05:01:25 +0000 |
---|---|---|
committer | bje <bje> | 1998-07-22 05:01:25 +0000 |
commit | 914b87dd71aeaa3d4d8b9e9308b336994be9d600 (patch) | |
tree | bb048c4c0fba0ab0806267b5fe6430245df7bc59 /tests | |
parent | 8fed7fd6f601e289477c1974ae9cf552aa15d426 (diff) |
New files.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/equal.c | 39 | ||||
-rw-r--r-- | tests/join.c | 12 | ||||
-rw-r--r-- | tests/self.c | 21 |
3 files changed, 72 insertions, 0 deletions
diff --git a/tests/equal.c b/tests/equal.c new file mode 100644 index 0000000..12dbfc2 --- /dev/null +++ b/tests/equal.c @@ -0,0 +1,39 @@ +/* + * Test for pthread_equal(). + * + * Depends on API functions: pthread_create(). + */ + +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> + +void * +func(void * arg) +{ + for (;;) + { /* spin */ } +} + +int +main(int argc, char * argv[]) +{ + pthread_t id[2]; + int rc; + + /* Create two threads and compare their thread IDs. + The threads will chew CPU, but ensure that their + IDs will be valid for a long time :-). */ + + pthread_create(&id[0], NULL, entry, NULL); + pthread_create(&id[1], NULL, entry, NULL); + + if (pthread_equal(id[0], id[1]) == 0) + { + /* This is impossible. */ + abort(); + } + + /* Never reached. */ + return 0; +} diff --git a/tests/join.c b/tests/join.c new file mode 100644 index 0000000..a353eae --- /dev/null +++ b/tests/join.c @@ -0,0 +1,12 @@ +/* + * Test for pthread_join(). + * + * Depends on API functions: pthread_create(). + */ + +#include <pthread.h> + +int +main(int argc, char * argv[]) +{ +} diff --git a/tests/self.c b/tests/self.c new file mode 100644 index 0000000..0addfc8 --- /dev/null +++ b/tests/self.c @@ -0,0 +1,21 @@ +/* + * Test for pthread_self(). + * + * Depends on API functions: None. + */ + +#include <pthread.h> + +int +main(int argc, char * argv[]) +{ + pthread_t id; + + /* We can't do anything with this, though, because it is not + safe to assume anything about the internal structure of + a `pthread_t'. */ + + id = pthread_self(); + + return 0; +} |