Update 2
In v11.0.0, situation seems getting worse. UnsetShared doesn't unshare at all. Even the code in help documentation doesn't work as expected.
Update
From technical support,
Thank you for contacting Wolfram Technical Support. I understand that you are reporting an issue with UnsetShared deleting the shared variable after a second evaluation. There seems to be an issue and I was able to reproduce it. I have forwarded an incident report to our developers and have included your contact information in my report.
Original Post
In[1]:= z = 1; SetSharedVariable[z];
ParallelEvaluate[z]
ParallelEvaluate[Print@z];
(==> Out[2]= {1, 1})
(during the evaluation)
(kernel 1) 1
(kernel 2) 1
Looks resonable. However,
In[4]:= UnsetShared[z];
ParallelEvaluate[Print@z];
(during the evaluation)
(kernel 1) 1
(kernel 2) 1
this is pretty strange since the z is not recognized by the subkernels anymore.
The most strange part is if you evaluate the In[4] again :
In[6]:= UnsetShared[z];
ParallelEvaluate[Print@z];
(during the evaluation)
(kernel 1) z
(kernel 2) z
This really disturbes me. Is this a bug or did I misunderstand something? (Windows 10, Mathematica v10.4)
z
printed after the firstUnsetShared
. I smell a bug. Can you contact support and report it to them? If they respond, can you let us know their response? $\endgroup$