02.07.2011, 03:59
Quote:
No, it's not that simple - I'm not even sure if the raknet library compiled in SA:MP is thread-safe (it CAN be, but you can compile it without thread safety for speed). This means that even if you do use entirely separate textdraws in separate threads, if raknet tries to send the data for the two textdraws (or indeed tries to send any data for anything at the same time as any data for anything else) it will entirely screw up (of course, the SA:MP server MAY be compiled with that one part multi-threaded - only Kye could answer that).
The bottom line is multi-threaded programming is HARD, not just a little tricky as you seem to be thinking, but VERY VERY HARD. Add to this the fact that, despite me telling the author several times, the lock thread function does nothing and you have serious issues. It is possible to write PAWN-based critical section locks using, for example: http://en.wikipedia.org/wiki/Dekker%27s_algorithm or: http://en.wikipedia.org/wiki/Peterson%27s_algorithm However these only work for two threads, not many, and as most PAWN natives are not thread safe you may need to put critical sections around almost everything, making threads actually WORSE than no threads. |