You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Avoid cloning with FetchContent](#avoid-cloning-with-fetchcontent)
@@ -124,6 +126,28 @@ While C++17 is recommended, C++11 is the minimum version required. This library
124
126
125
127
This library requires C++ exceptions to be enabled (for example, do not compile with `-fno-exceptions`).
126
128
129
+
### Threading Modes
130
+
By default, `csv-parser` uses a background thread to parse file-based input. If CMake cannot find a thread library, threading is disabled automatically.
131
+
132
+
You can also disable it explicitly:
133
+
134
+
**CMake**
135
+
```cmake
136
+
set(CSV_ENABLE_THREADS OFF)
137
+
add_subdirectory(csv-parser)
138
+
```
139
+
140
+
**Non-CMake (define the macro before any csv-parser header)**
141
+
```cpp
142
+
#defineCSV_ENABLE_THREADS 0
143
+
#include "csv.hpp"
144
+
```
145
+
146
+
Single-threaded mode is useful for embedded targets, environments where `std::thread` is unavailable, and WebAssembly builds without pthreads. The public API is unchanged; parsing simply runs synchronously on the caller's thread.
147
+
148
+
### Emscripten / WebAssembly
149
+
On Emscripten, `CSV_ENABLE_THREADS` is forced off and memory-mapped parsing is replaced by the stream-based parser. The filename constructor (`CSVReader("file.csv")`) still works—it opens an `std::ifstream` internally instead of using mmap.
150
+
127
151
### Single Header
128
152
**[📥 Download csv.hpp](https://vincentlaucsb.github.io/csv-parser/csv.hpp)** — Available on GitHub Pages
129
153
@@ -141,6 +165,10 @@ and add the following to your CMakeLists.txt:
0 commit comments