Составители:
void*, в которую будет записано значение, возвращаемое потоком.
Если данное значение не важно, в качестве второго аргумента зада-
ется NULL.
/* thread1.c
* This program creates one new thread.
* New thread and main thread increase static shared variable on 1.
* Each thread in a process is identified by a thread ID.
to compile: gcc -o thread1 thread1.c -lpthread
http://www.intuit.ru/department/os/osintropractice/examples.html */
#include <pthread.h>
#include <stdio.h>
int a = 0;
void *mythread(void *dummy)
{
pthread_t mythid;
mythid = pthread_self();
a = a+1;
printf("Thread-1 %d, Calculation result = %d\n",
mythid, a);
return NULL;
}
int main()
{
pthread_t thid, mythid;
int result;
40
Страницы
- « первая
- ‹ предыдущая
- …
- 38
- 39
- 40
- 41
- 42
- …
- следующая ›
- последняя »