AnsweredAssumed Answered

Questions about multithreading

Question asked by snicolay on Sep 21, 2015
Latest reply on Dec 11, 2017 by Stan Bischof
Hello,
I encounter some issues using Agilent Vee Pro 9.32 and the documentation is not clear about multithreading, could someone help me please :
I want to have 2 threads, each generating random data and storing the generated data in a global variable. This global variable is a record with several fields, Thread 1 stores data in one field, Thread 2 stores data in another field (not the same as Thread 1). When I run the program, it starts running ok, but after a few seconds, it crashes. So I'm wondering:

- Is possible to use global variables in thread objects ?
- If I declare a global record with 2 fields, is it possible that 2 threads access different fields of the same record at the same time, or should I protect the access to the record ?
- Is there a way to protect the data such as a semaphore ? (cannot find any semaphore object)

Thank you.  

Outcomes