AI Features

Thread Creation

This lesson introduces you to the process of the creation of a thread.

We'll cover the following...

The first thing you have to be able to do to write a multi-threaded program is to create new threads, and thus some kind of thread creation interface must exist. In POSIX, it is easy:

#include <pthread.h>
int
pthread_create(pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine)(void*),
void *arg);

Explanation

This declaration might look a little complex (particularly if you haven’t used function pointers in C), but actually it’s not too bad. There ...

Ask