Hello
I compiled & installed gcc4.4 using macports.
When I try to compile using -> g++ -g -Wall -ansi -pthread -std=c++0x main.cpp...:
#include <thread>
...
std::thread t(handle);
t.join();
....
The compiler returns:
cserver.cpp: In member function 'int CServer::run()':
cserver.cpp:48: error: 'thread' is not a member of 'st...
Hi all,
Let's say I have a situation in Silverlight where there is a background thread (guaranteed to NOT be the UI thread) doing some work and it needs to create a new thread. Something like this:
//running in a background thread
Thread t = new Thread(new ThreadStart(delegate{});
t.Start();
Lets also say that the UI thread at this p...
Any creative ideas to avoid deadlocks on a yield or sleep with cooperative/non-preemptive multitasking without doing an O/S Thread.Sleep(10)? Typically the yield or sleep call will call back into the scheduler to run other tasks. But this can sometime produce deadlocks.
Some background:
This application has enormous need for speed and,...
I have an application which performs 30 independent tasks simultaneously using multithreading,
each task retrieves data over http, performs a calculation and returns a result to the ui thread.
Can I use TPL to perform the same tasks?
Does TPL create 30 new threads and spread them over all the available cores, or does it just split the ...
Hi all
I have a WinForm drawing a chart from available data.
I programmed it so that every 1 secong the Winform.Timer.Tick event calls a function that:
will dequeue all data available
will add new points on the chart
Right now data to be plotted is really huge and it takes a lot of time to be executed so to update my form. Also ...
I am writing code that will spawn two thread and then wait for them to sync up using the CyclicBarrier class. Problem is that the cyclic barrier isn't working as expected and the main thread doesnt wait for the individual threads to finish. Here's how my code looks:
class mythread extends Thread{
CyclicBarrier barrier;
public myt...
I ran cprofile on a bit of code, which among other things spawns several threads that do most of the work.
When I looked at the output of the profiling, I see no logging of all the functions that were called inside the threads. I am sure they were called, as they do stuff that is easy to see such as writing to a DB etc.
Does cProfile no...
In the boost::shared_ptr destructor, this is done:
if(--*pn == 0)
{
boost::checked_delete(px);
delete pn;
}
where pn is a pointer to the reference counter, which is typedefed as
shared_ptr::count_type -> detail::atomic_count -> long
I would have expected the long to be volatile long, given threaded usage and the non-atomic ...
I am trying to use the code from Microsoft for an Async Socket connection. It appears the listener runs in the main thread locking the GUI. I am new at both socket connections and multi-threading all at the same time. Having a hard time getting my mind wrapped around this all at once.
The code used is at http://msdn.microsoft.com/en-us/...
If a thread is interrupted while inside Object.wait() or Thread.join(), it throws an InterruptedException, which resets the thread's interrupted status. I. e., if I have a loop like this inside a Runnable.run():
while (!this._workerThread.isInterrupted()) {
// do something
try {
synchronized (this) {
this.wai...
Hey, guys, I am just starting to wrap my head around objective C and I am doing a little project on Iphone. And I just encountered a weird problem. I had to deal with images in my program so I have a lot local variables declared like temp[width][height]. If I am not using NSThread to perform image processing, it works all fine. However, ...
I think this is a common scenario for multithreaded Java applications so I'll try to describe it here.
In my Java App I've a threadExecutor object that defines a Pool of 5 Threads.
ExecutorService threadExecutor = Executors.newFixedThreadPool(5);
A sendCallables method is responsible to assign a List of Jobs to the Executor.
I keep t...
I need to put request specific data in WCF? Is it safe to use ThreadStatic variable in WCF?
...
For sake of abstraction, let's assume that I have a
Map<Double, Collection<Employee>>
where key is salary threshold. Or for people familiar with Google collections it would be as
Multimap
I want to do a database lookup for each Employee's salary and if it's less than the salary threshold remove the employee it from the collection. ...
Experts -
I need some advice in the following scenario.
I have a configuration file with a list of tasks. Each task can have zero, one or more dependencies. I wanted to execute these tasks in parallel [right now they are being executed sequentially]
The idea is to have a main program to read the configuration file and load all the ta...
I've written a 'server' program that writes to shared memory, and a client program that reads from the memory. The server has different 'channels' that it can be writing to, which are just different linked lists that it's appending items too. The client is interested in some of the linked lists, and wants to read every node that's added ...
We are facing a very complex issue in our production application.
We have a WCF method which creates a complex Entity in the database with all its relation.
public void InsertEntity(Entity entity)
{
using(TransactionScope scope = new TransactionScope())
{
EntityDao.Create(entity);
}
}
EntityDao.Cr...
I read a chapter in a book (Seven languages in Seven Weeks by Bruce A. Tate) about Matz (Inventor of Ruby) saying that 'I would remove the thread and add actors, or some other more advanced concurrency features'.
Why and how an actor model can be an advanced concurrency model that replaces the threading?
What other models are the 'adv...
I was reading http://stackoverflow.com/questions/1511798/threading-from-within-a-class-with-static-and-non-static-methods and I am in a similar situation.
I have a static method that pulls data from a resource and creates some runtime objects based on the data.
static class Worker{
public static MyObject DoWork(string filename){
...
Hi,
I've got some questions about Java's assigment.
Strings
I've got a class:
public class Test {
private String s;
public synchronized void setS(String str){
s = s + " - " + str;
}
public String getS(){
return s;
}
}
I'm using "synchronized" in my setter, and avoiding it in my getter, because in my app, there are a to...