+ 3

So, pthread.h is off limits?

I guess the title says a lot, but I tried to run a C code in the playground, and couldn't include the pthread header file. https://code.sololearn.com/c4bFCVcLmtTL

1st Feb 2018, 9:54 AM
eRosz
eRosz - avatar
5 Réponses
+ 9
Lol thanks for the heads up.
1st Feb 2018, 10:25 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Nevermind, I just remembered that the code is ran on windows. 'pthread.h' does not exist in Windows. In Windows you actually use the multithreading techniques provided by 'windows.h'. Sorry for bothering, but hopefully this helped someone else as well.
1st Feb 2018, 10:04 AM
eRosz
eRosz - avatar
+ 4
I think even if SoloLearn ran on linux computers, you would not be able to use pthread.h as they might not add the linking option '-lpthread'
1st Feb 2018, 12:07 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
If anyone is interested, here's an example of multithreading within C, and also an example on how to pass an array to functions, or other threads. https://code.sololearn.com/crzyaEUJde4z/?ref=app
1st Feb 2018, 11:51 AM
eRosz
eRosz - avatar
+ 2
Yeah, that's true. Haven't thought of that, but they could definitely fix that with some "clever" engineering.
1st Feb 2018, 12:39 PM
eRosz
eRosz - avatar