Link to home
Start Free TrialLog in
Avatar of blaze_wk
blaze_wk

asked on

Thread able to view modifications within main program?

Hi,

I am implementing an array within the main program and I am implementing a separate thread. Say if the array is passed to the thread as an argument and the array is constantly being modified within the main program. Can the thread still see the modified data of the array at any time? For example,

array declared with values {5,34,6,3} initialized within main program

Thread now started and array passed as an argument to thread

array modifed to be {4,5,6,3,3,5,6}

If the thread accesses the array at this time will the thread be able to see the array with the new values?

Thanks
Avatar of Mick Barry
Mick Barry
Flag of Australia image

yes
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial