Hello guys,
I would really need the threading module for the Windows build. Is this possible already? I found it in the Unix build, and i know that somehow the windows build uses unix.
Sorry if this question is dumb, but i dont know what to do .
Threading Module for Windows build
Re: Threading Module for Windows build
This isn't implemented yet. The windows ports (mingw-w64 or msvc) indeed use some of the unix port's files but the threading code isn't one of those: I looked into that once and since it uses posix threading, for the msvc port this would mean either using an external win32<->posix thread library or writing it from scratch. As I didn't have any use for threading at the time it was introduced in uPy I only quickly tried the first option but that took a couple of tries, none of them succesful, so I just gave up. However possibly for mingw-w64 it just works as-is by adding the source to the makefile and setting an option in mpconfigport.h. Which port are you using?
Re: Threading Module for Windows build
Ohh ok, thanks for your response..
I am currently doing my bachelor thesis and my goal is to wrap a can-stack library written in C. The thing is it is important that the build also runs on windows so i guess i can't use micropython to do this in that case, because threading is required.
The build for Embedded Systems would have just been a "nice to have"...
I guess the best solution would be to make 2 versions then, one for windows and later when needed for micropython. That's a bit sad for me because i really started liking this project. Maybe i can use it the next time when i make something
I understand that the main focus of this project is to support microcontrollers of course
I tried to add the sources to the Makefile but I didn't get it working...
I am currently doing my bachelor thesis and my goal is to wrap a can-stack library written in C. The thing is it is important that the build also runs on windows so i guess i can't use micropython to do this in that case, because threading is required.
The build for Embedded Systems would have just been a "nice to have"...
I guess the best solution would be to make 2 versions then, one for windows and later when needed for micropython. That's a bit sad for me because i really started liking this project. Maybe i can use it the next time when i make something
I understand that the main focus of this project is to support microcontrollers of course
I tried to add the sources to the Makefile but I didn't get it working...
Re: Threading Module for Windows build
Yeah I also just tried adding mpthreadport.c to the Makefile, copied mpthreadort.h to the windows directory but no go: mingw doesn't have siginfo_t and the likes.
Looking at mpthreadport.c however it doesn't seem too hard to create a similar file which works with win32 threads/mutexes. There's not really a win32 equivalent for signals but that shouldn't matter, I think it's ok for mp_thread_gc_others to just loop over the other threads and gc_collect_root on them (that's also what e.g. the stm32 port does). I understand you're working on your thesis so you have other things to do, but should you have time left you could always have a go at porting it
Looking at mpthreadport.c however it doesn't seem too hard to create a similar file which works with win32 threads/mutexes. There's not really a win32 equivalent for signals but that shouldn't matter, I think it's ok for mp_thread_gc_others to just loop over the other threads and gc_collect_root on them (that's also what e.g. the stm32 port does). I understand you're working on your thesis so you have other things to do, but should you have time left you could always have a go at porting it
Re: Threading Module for Windows build
Well i guess i have to let this approach then because i don't get it working. It's sad that the windows-build is required for me. The port for the STM32 and i guess other microcontrollers is amazing already