The need for threadsafe/unicode subsystems?
Posted: Mon Mar 31, 2008 8:53 am
What makes PureBasic's userlibraries different from Tailbite libraries that requires us to compile specific subsystems for threadsafe/unicode executables?
http://www.purebasic.com
https://www.purebasic.fr/english/
If Tailbite did compile 4 merged sources then wouldn't you only have to include the different routines when the source was actually different?Now the thing when creating user libraries to hold multiple versions of the same command is that it is best done by 'hand'. Think about it for a minute; if Tailbite was to create a single library from your source containing the threadsafe / unicode versions etc. then it would need to know which commands to split in this way. If it simply split every single function then it could end up creating a very large library indeed and this is on top of all the work required to ensure that those functions calling other functions within the library called the correct versions etc. It would be a lot of work. A hell of a lot of work!
Yes, but you are talking about cases in which the necessity for creating a separate threadsafe version of the function in question is determined purely by whether it calls threadsafe versions of native Purebasic functions or not? There are many other cases to consider when the function in question does not actually call any threadsafe versions of PB functions but, nevertheless still needs to export a threadsafe version. Sure, in these cases a single threadsafe version of the function would suffice in all cases (unicode excluded) but, such a version may not be as optimised as having a non-threadsafe version together with a threadsafe version etc. This is the whole point with PB and non-threadsafe libraries, they will generally run faster than their threadsafe counterparts because you do not need to use thread local storage etc.What I mean is that if the asm source of PB_MyCommand_THREAD was the same as the asm source of PB_MyCommand then just include PB_MyCommand as it must not have used any thread specific routines?
This would be great, it would also get rid of the need to have loads of combinations of library files.What would be interesting, imo, is a version of Tailbite which allowed you to create multiple versions of the same function within the same source. E.g. ProcedureDll MyFunction() and ProcedureDll MyFunction_THREAD() in which I can perform all non-threadsafe optimisations as appropriate. Tailbite would then recognise my wish to create two versions of the same function and compile separately etc. Still a lot of work but this would be closer to the situation when creating the libraries in c or raw asm.