Re: threads in python

2020-08-28 Thread AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector


  


Re: threads in python

As far as I can tell this isn't so much an issue with the library as it is an issue with your code and knowledge of the way threading works.In the slim chance that someone is searching around and has the same question, I explained more in the issue he created.

URL: https://forum.audiogames.net/post/565311/#p565311




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-28 Thread AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector


  


Re: threads in python

This isn't an issue with threads

URL: https://forum.audiogames.net/post/565309/#p565309




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-26 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: threads in python

@5, ah, I stand corrected then.

URL: https://forum.audiogames.net/post/564839/#p564839




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: threads in python

@2that's incorrect. For what they're trying to do, threading will work.  The non-newbie answer to this is that there's a mutex plus a timeout around the bytecode interpreter loop, but this means that anything doing I/O and anything doing calls into C won't block it, and even if you're doing a bunch of Python threads they are actually OS threads that do actually schedule, and they don't all get blocked or anything like that, you're just limited to single-core compute performance.  So i.e. socket.read() will happily run in parallel and reacquire the GIL when data arrives.  Cython lets you get around it some but only if you're explicit about releasing the GIL, as really Cython is a way to write Python C extensions without using C, not a thing for binding C libraries.   I think CFFI knows how to always release it when calling into C by default.The newbie answer, for everyone who reads the above paragraph, is that it doesn't matter for games because in practice a game can't rely on more than one core anyway.  I don't remember the Python threading API offhand but the above looks broadly right; I'm guessing it's something to do with whatever the library is.  In general, if the library isn't threading-aware and you try to use it with threads without some form of lock or other synchronization, it'll crash or do weird things.  That's true of any programming language, and what I suspect may be happening here, though if you want to verify if the therad is running, write a function that prints.  The Python-specific threading details can be ignored until you decide you want to do something like pathfinding in background threads, but since trying to do that sort of thing is a terrible idea for a whole host of other reasons, it probably won't ever come up.

URL: https://forum.audiogames.net/post/564796/#p564796




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-26 Thread AudioGames . net Forum — Developers room : ivan_soto via Audiogames-reflector


  


Re: threads in python

You should use callbacks for the tt api that Carter wrote

URL: https://forum.audiogames.net/post/564776/#p564776




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-26 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: threads in python

I wonder if using something like asyncio in your case would help, since what you're after is simply the function not blocking as far as I understand.

URL: https://forum.audiogames.net/post/564773/#p564773




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: threads in python

2020-08-26 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: threads in python

To my knowledge, threading in Python just doesn't work without cythonizing your code first. You can thank the GIL for that -- there's no way to get maximum performance out of Python without dropping into C or being really clever.

URL: https://forum.audiogames.net/post/564751/#p564751




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector