I'm trying to understand why this code is not working.
private static object _lock;
public static void Main (string[] args)
{
Thread thread;
_lock = new object();
foreach (int num in Enumerable.Range(0,5)) {
thread = new Thread (() => print(num.ToString()));
thread.Start(); ...
Hi
I've seen a few examples of using delegate with multiple threads for async image loading with cocoa's URL loading system.
I think the process goes like below.
Thread 1 :
give thread 2 an operation to perform, and a delegate which thread 2 will access upon completion.
Thread 2 :
upon completing the operation, calls a predefined se...
I'm part of a team designing the server for a client/server model naval warfare video game (University course). We have a fairly concrete (well, I think) system design, but there is one aspect that bothers me.
The basic layout of the system is:
Server [thread] (handles incoming connections)
|
Game [thread] (deals with game events in it...
In WPF application I use Textbox with custom style in which ContextMenu is overriden like this:
<Style TargetType="{x:Type TextBox}">
<Setter Property="ContextMenu">
<ContextMenu>
<MenuItem Header="Copy"/>
</ContextMenu>
</Setter>
</Style>
This works perfectly until I'll run window with TextBox in diffe...
I'm planning to make a software with lot of peer to peer like network connections. Normally I would create an own thread for every connection to send and receive data, but in this case with 300-500+ connections it would mean continuously creating and destroying a lot of threads which would be a big overhead I guess. And making one thread...
When I click on a button in Silverlight I want to run a method 2 seconds later once only for each time I click the button .. in the meantime the rest of the app keeps working .. obviously Thread.Sleep stops the whole UI .. how do I do this?
...
What is mean term "Read-only thread safety" Can anyone post some code example?
...
Hi,
I am programming an application in Ruby which creates a new thread for every new job. So this is like a queue manager, where I check how many threads can be started from a database. Now when a thread finishes, I want to call the method to start a new job (i.e. a new thread). I do not want to create nested threads, so is there any wa...
Hello EveryOne I am using WPF and I made some customecontrol just like a treeview, but this is
the listtreeview so I am loading my all data into this treeview so it will take a much of time.
so I am worry about how to implement threading to improve the perfomance...
its urgent if u guys tell me.
Thanks..
...
Hi,
Assume the following class
public class TestObject{
public void synchronized method1(){
//some 1000 lines of code
}
public void method2(){
//some 1000 lines of code
}
}
Let's assume there are two threads accessing the same instance of TestObject class, let's call them t1 and t2. I want to know wha...
Hi!
I'm working with the Gnuradio framework. I handle flowgraphs I generate to send/receive signals. These flowgraphs initialize and start, but they don't return the control flow to my application:
I imported time
while time.time() < endtime:
# invoke GRC flowgraph for 1st sequence
if not seq1_sent:
tb = se...
So the thing is, I want to be able to do this with my class.
object.lockAccess();
object.doSomething();
object.doAnotherThing();
object.doAnotherThingYet();
object.unlockAccess();
So the other thread will not be able to access my class methods while locked.
Here is the implementation I did, I was wondering if someone got a better idea,...
T BlockingQueue<T>::pop( ) {
pthread_mutex_lock(&lock);
if (list.empty( )) {
pthread_cond_wait(&cond) ;
}
T temp = list.front( );
list.pop_front( );
pthread_mutex_unlock(&lock);
return temp;
}
The above is the pop operation as defined for a templatized concurrent blocking qu...
I am still learning about using Future and Callable in Java.
Stumble into this question:
Say I have class:
TaskWorker implements Callable {
public String id;
public TaskWorker(String id) {
this.id = id;
}
public Documents call() trows Exception {
//Assume here, that Search and Doc are my own method to search and re...
I used strace to attach to a process briefly. The process created 90 threads. When I found the offending thread, I had to tediously search for the parent thread, then the grandparent thread, and so on all the way to the root process. Is there a trick or tool to quickly figure out which thread created another? Or better yet, print the tre...
I'm currently making a IRC bot in Java (I know, there are frameworks out there) and I'm trying to have it connect to multiple servers. The problem I'm having with this is not the connecting part, I'm just running my Connect class in x amount of threads. Each thread will connect the bot to the server/port specified. Now my problem is that...
Caveat: I realize this is potentially a server configuration question, but I thought there might be a programmatic answer, which is why I am posting here...
Running PHP on Apache, our users were able to issue multiple concurrent requests (from different tabs in the same browser, for example).
Since moving to FastCGI under IIS, this is...
Hi everyone,
I have a problem in understanding how the winapi condition variables work.
On the more specific side, what I want is a couple of threads waiting on some condition. Then I want to use the WakeAllConditionVariable() call to wake up all the threads so that they can do work. Besides the fact that i just want the threads starte...
I am trying to come up with some tactics for hooking the connection event whenever an instance is created in my WCF server.
I decorated my class like this:
[ServiceBehavior( InstanceContextMode = InstanceContextMode.PerCall , ConcurrencyMode = ConcurrencyMode.Multiple , Namespace="http://mystuff/test" )]
So I was wondering if there was...
Hello,
My UI is using QTreeView with QFileSystemModel to be able to select folders and files. The documentation for QFileSystemModel says that file structure update is done on a seperate thread which would mean the UI would not be blocked. However, this is not the case for me and I can't figure out the discreptency and how other peopl...