| 1 | module threads |
| 2 | |
| 3 | // This module adds the necessary compiler flags for using threads. |
| 4 | // It is automatically imported by code that does `go func()` . |
| 5 | // See vlib/v/parser/pratt.v, search for ast.GoExpr . |
| 6 | // The goal is that programs, that do not use threads at all will not need |
| 7 | // to link to -lpthread etc. |
| 8 | // Note: on some platforms like Android, linking -lpthread is not needed too. |
| 9 | // See https://stackoverflow.com/a/31277163/1904615 |
| 10 | |
| 11 | $if !windows && !android { |
| 12 | #flag -lpthread |
| 13 | } |
| 14 | |