2014年1月2日星期四

Ask a question

I want to do is to use two threads , one pair of loops member variable j + + operations , also a member of another variable j + + operations performed ( j I would like to use the original data ) , I would like to ask , first thread the results of the second thread can not affect you
------ Solution --------------------------- -----------------

now want to use two threads j raw data is there any way ah  
thread before a start , the member variable j is not assigned to a new variable to OK it? or copy an instance of the entire class. Did not see your specific needs. Did not answer .
------ Solution ---------------------------------------- ----

now want to use two threads j raw data is there any way ah                
thread before a start , the member variable j is not assigned to a new variable to OK it? or copy an instance of the entire class. Did not see your specific needs. Did not answer .          
can be assigned to a new variable , that copy an entire class of real class how to do ah  
class covering the Object clone method to realize the depth of the copy , and then clone a the object, but not recommended. Simple is best , since it can be assigned to a new variable to achieve your needs , no need to engage in complex.
------ For reference only -------------------------------------- -
My problem now is that the data
------ For reference only second thread j less than the original data is always used in the operation of the first thread after ---- -----------------------------------
will produce multi-threaded shared variable problem , since the variables shared and multi-threading competition with a variable , of course, will cause the thread synchronization problem. How to prevent an impact thread two threads , no way. Want to use a variable thread before the modification can consider other ways ah
------ For reference only ------------------------- --------------
is not this is not a two j j j ah can check your output value j , respectively, in the two threads were observed
------ For reference only -------------------------------------- -
this topic online a lot . Face similar questions have Soso look .
------ For reference only -------------------------------------- -

now want to use two threads j raw data is there any way ah
------ For reference only ----------------- ----------------------

now want to use two threads j raw data is there any way ah
----- - For reference only ---------------------------------------

j is a member variable ah , it is impossible not a
------ For reference only ---------------------------- -----------
two threads with a member variable of the same object to operate , and of course there will be the case above ah. Is it inconsistent to understand ? Code stickers better explanation.
------ For reference only -------------------------------------- -

now want to use two threads j raw data is there any way ah          
thread before a start , the member variable j is not assigned to a new variable to OK it? or copy an instance of the entire class. Did not see your specific needs. Did not answer .  
can be assigned to a new variable , the real class copy the entire class how to do ah
------ For reference only ------------------ ---------------------

now want to use two threads j raw data is there any way ah                      
thread before a start , the member variable j is not assigned to a new variable to OK it? or copy an instance of the entire class. Did not see your specific needs. Did not answer .                
can be assigned to a new variable , that copy an entire class of real class how to do ah          
class covering the Object clone method to realize the depth of the copy , and then clone a the object, but not recommended. Simple is best , since it can be assigned to a new variable to achieve your needs , no need to engage in complex.  
thank you

没有评论:

发表评论