Thread BUG?

Just starting out? Need help? Post your questions and find answers here.
AtomUpgrader
User
User
Posts: 17
Joined: Fri Jun 21, 2013 11:59 am

Thread BUG?

Post by AtomUpgrader »

Code: Select all

Global test.l

Procedure AlertThread(Parameter)
Repeat
test + 1
Debug "1: " + str(test)
Delay(2000)
ForEver
EndProcedure

CreateThread(@AlertThread(), 0)
Repeat
Debug "2: " + str(test)
Delay(2000)
ForEver
Displayed
2: 0
1: 1
2: 11潳䱲瑥整ㅲ
1: 2
1: 32‱‽റ㬊䌠
2: 3
2: 1:
2: 1:
1: 52
2: 5
This is my first experience with threads and what am I doing wrong?
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Thread BUG?

Post by STARGÅTE »

No Bug!

If you want to use Threads, you have to enable "Thread Safe" in the compiler settings:
Create thread-safe executable
This tells the compiler to use a special version of certain commands to make them safe to be used in threads. See the Thread library for more information.

This also enables the Debugger to display correct information if threads are used. Without this option, the debugger might output wrong line numbers when threads are involved for example.

Code: Select all

CompilerIf #PB_Compiler_Thread = #False
	CompilerError "Enable Thread Safe"
CompilerEndIf
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Thread BUG?

Post by Little John »

AtomUpgrader wrote:This is my first experience with threads and what am I doing wrong?
Please don't ask your coding questions in the "Bug reports" section of the forum. Thank you.

Also
Please read before submitting a bug report !
AtomUpgrader
User
User
Posts: 17
Joined: Fri Jun 21, 2013 11:59 am

Re: Thread BUG?

Post by AtomUpgrader »

Sorry, ok :oops:
Post Reply