About arrays mutex and threads...

Just starting out? Need help? Post your questions and find answers here.
User avatar
Caronte3D
Addict
Addict
Posts: 1370
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

About arrays mutex and threads...

Post by Caronte3D »

If I have a global array: Texts.s(10) and 10 threads accessing this array but only on her index number, should I use a mutex because the array is global or not needed because each thread access only her index position?

Thread_0 can access only to Texts(0)
Thread_1 can access only to Texts(1)
and so on...
User avatar
NicTheQuick
Addict
Addict
Posts: 1527
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: About arrays mutex and threads...

Post by NicTheQuick »

In this case you should be fine with using no Mutex at all. But you still have to enable the threadsafe option in the compiler options because you are handling strings.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
Caronte3D
Addict
Addict
Posts: 1370
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: About arrays mutex and threads...

Post by Caronte3D »

That's what I thought, but I want to be sure because it's a pain to find related errors later.
Thanks by your help :wink:
Post Reply