in reply to Re^8: does threads (still) memleak?
in thread does threads (still) memleak?
How do I share new data between old threads?
Hm. That is a very ambiguous question. Essentially, all shared variables are accessible from all threads. So, as soon as you assign a new value to an existing shared variable, it (the new value), becomes available to all other threads the next time they get a timeslice.
Of course, that then raises the questions:
One way to notify threads of the availability of new values is to use the cond_* functions in threads::shared, but that is often the hardest and most error prone way of doing things. There are all sort of caveats to do with missed signals, deadlocks etc. Thread::Queue is usually far easier to both use, and to reason about.
To be able to give you a good answer to the problem underlying your question, we would need to know a little more about that problem. I can sit here and try t dream up scenarios for what you are trying to achieve, and come op with half a dozen that would all completely miss the mark. In other words, please post a little code demonstrating the problem you are trying to tackle, then we stand a better than even chance of offering you an appropriate solution.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: does threads (still) memleak?
by faxm0dem (Novice) on Nov 27, 2008 at 15:31 UTC | |
by BrowserUk (Patriarch) on Nov 27, 2008 at 16:19 UTC | |
by faxm0dem (Novice) on Nov 27, 2008 at 16:52 UTC | |
by BrowserUk (Patriarch) on Nov 27, 2008 at 18:25 UTC | |
by faxm0dem (Novice) on Nov 28, 2008 at 14:11 UTC | |
| |
by faxm0dem (Novice) on Nov 28, 2008 at 13:02 UTC | |
by BrowserUk (Patriarch) on Nov 28, 2008 at 13:30 UTC | |
by faxm0dem (Novice) on Nov 28, 2008 at 13:53 UTC | |
|