ashwathgan Posted July 15, 2015 Report Share Posted July 15, 2015 Hi all If I have something like follows:SC_MODULE(Test) { ... int t1; // Want this variable to be shared void tesst() { t1 = t1 +2; } SC_CTOR(Test) { SC_THREAD(tesst) } And then I create two instances of Test as Test *t1 = new ....; Test *t2 = new ... Then , how can make the varible "t1"shared by both the instances/ threads? In other words, I want this variable to be updated by both the threads. Thanks Quote Link to comment Share on other sites More sharing options...
Dineshkumar Posted July 16, 2015 Report Share Posted July 16, 2015 Hi, You can make t1 as static variable. Regards, Dinesh. Quote Link to comment Share on other sites More sharing options...
ashwathgan Posted July 24, 2015 Author Report Share Posted July 24, 2015 Thanks a lot sir. It worked Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.