README.md
1# Pthread Example
2
3(See the README.md file in the upper level 'examples' directory for more information about examples.)
4
5ESP-IDF provides implementations for many standard POSIX Threads (pthread) APIs. These APIs are impmlemented as thin wrappers around FreeRTOS APIs.
6
7This example demonstrates how to create threads using this API, and how to use the ESP-IDF pthreads extension API to set default thread parameters for the related FreeRTOS tasks. For complete details about supported Pthreads APIs, consult the ESP-IDF Programmers Guide.
8
9## How to use example
10
11### Hardware Required
12
13This example should be able to run on any supported Espressif SoC development board.
14
15### Configure the project
16
17```
18idf.py set-target esp32
19```
20
21(Replace `esp32` with the name of the chip target you are using.)
22
23```
24idf.py menuconfig
25```
26
27### Build and Flash
28
29Build the project and flash it to the board, then run monitor tool to view serial output:
30
31```
32idf.py -p PORT flash monitor
33```
34
35(Replace PORT with the name of the serial port to use.)
36
37(To exit the serial monitor, type ``Ctrl-]``.)
38
39See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
40
41## Example Output
42
43```
44Created thread 0x3ffaff74
45Created larger stack thread 0x3ffb7ca8
46This thread has ID 0x3ffb7ca8 and 15896 bytes free stack
47This thread has ID 0x3ffaff74 and 2616 bytes free stack
48Thread 0x3ffaff74 exiting
49Thread 0x3ffb7ca8 exiting
50Threads have exited
51
52Created thread 0x3ffb44c8 with new default config
53This thread has ID 0x3ffb44c8 and 32312 bytes free stack
54Thread 0x3ffb44c8 exiting
55Thread has exited
56```
57