I keep getting this error for a portion of my code.
Traceback (most recent call last):
File "./mang.py", line 1688, in <module>
files, tsize = logger()
File "./mang.py", line 1466, in logger
nl = sshfile(list, "nl")
UnboundLocalError: local variable 'sshfile' referenced before assignment
I haven't put the code up cause it goes back an...
I am trying to figure out how to get my client to send and receive data 'simultaneously' and am using threads. My problem is that, depending on the way I set it up, the way here it waits for data from the server in the recieveFromServer function which is in its own thread and cannot stop it when nothing will be sent. The other way it j...
Hi
Could someone please help with this? I have the following:
// part_1
if (pthread_create(&threadID, NULL, ThreadMain,
(void *) clientSocket) != 0) {
cerr << "Unable to create thread" << endl;
exit(1);
}
// part_2
void *ThreadMain(void *clientSocket) {
pthread_detach(pthread_self());
...
delete (TCPSocket *) c...
If I have something like this (pseudocode):
class A
{
List<SomeClass> list;
private void clearList()
{
list = new List<SomeClass>();
}
private void addElement()
{
list.Add(new SomeClass(...));
}
}
is it possible that I run into multithreading problems (or any kind of unexpected behavior) w...
Learning to build multithreading WPF applications I read about some restrictions in using BackgroundWorker that was not very clear for me. Please, help me to understand:
If I want not only one thread working behind the scene of UI, but maybe several ones, starting and ending independently one from another, will the BackgroundWorker fit...
I fear this is obvious, but would someone mind confirming that the private fields of WebServices are thread safe? Specifically,
1) In the code below, each thread will get a new instance of the ReportService class
protected void Page_Load(object sender, EventArgs e)
{
// Client side scripting
ScriptManager scriptManager = Scrip...
I'm programming on Android, but I guess this is a general Java 101 question...
I want myMethod() to run every X ms without blocking the UI - it should be possible to start and stop this thread. The value of X milliseconds will change whilst it's being run. myMethod() needs read access to an array which is manipulated by the UI.
How ca...
Please, explain the difference between "DispatcherTimer" and "a regular Timer" that @Kent Boogaart meant for using in a multithreading WPF app as a task sheduler in this topic:
http://stackoverflow.com/questions/1341829/advice-needed-for-multi-threading-strategy-for-wpf-application
in the commentaries to one of the post (quote):
-If a...
I want to wait on a condition for up to 1 second. I've try passing in time_duration:
boost::posix_time::time_duration td = boost::posix_time::milliseconds(50);
readerThread_cond_.timed_wait(lock, boost::bind(&XXXX::writeCondIsMet, this), td);
but I get the error:
/usr/include/boost/thread/pthread/condition_variable.hpp:156:
erro...
I have a client and a host program (written in c) which I want to run from two different remote locations simultaneously. Since I have to do this some 50 times to gather data, I don't want to have to run them individually. On one side, I need to log in via ssh, start the script and tell it to write the output to a file. Then I need to...
I'm working on a parallelization library for the D programming language. Now that I'm pretty happy with the basic primitives (parallel foreach, map, reduce and tasks/futures), I'm starting to think about some higher level parallel algorithms. Among the more obvious candidates for parallelization is sorting.
My first question is, are p...
Hi everyone:
This is my first attempt on semaphores and threads.
I constructed this code from examples and the man pages found on the Net.
I have two doubts with this code.
Why do I get a Bus error whenever I try semctl( I know this is the root of the problem because of the debug line 3 does not get printed) and how to prevent it?
Wh...
Hi, I'm writing a little script, that will create archives in main thread and after each archive is complete, a new thread would be created by calling function that would take care of uploading these archives. The reason I want uploading to be done in background is so that another archive could be created while the previous archives are ...
Hi folks, if a threadA is sleeping, how will another thread threadB call threadA to start ?
Please provide an example if possible.
...
Please pardon the naivety of this question. It's 2:00 AM.
In doing some performance monitoring of a multi-threaded application I was playing with (.NET, C#), I realized that the loop in a time-sensitive worker thread would be interrupted on occasion. Makes sense, there are many threads the OS needs to tend to. This affects the consis...
Hi,
I am having this doubt about multi-threading and I have faced lots of questions about in multi-threading in many of the interviews.
I speak a lot of about acquiring a lock on the object as such. My doubt is when you have two methods that are synchronized and there are two threads which wants to access those two methods, ThreadA wan...
I have some COM component which I call from some c# dll.
I also have a winforms app that uses that .dll.
When I close the app I get this exception:
COM object that has been separated
from its underlying RCW cannot be
used.
The stack trace shows this exception comes from a destructor in the .dll. I implemented this destructor ...
Hay,
My system needs to execute several major SQL`s (on Oracle DB) using the same connection (asynchronous).
What`s the best practice for this issue?
1. open single connection and execute every SQL statement on different thread (does it thread safe?)
2. create new connection and “open + close” it for every SQL statement
Thanks,
Hec
...
I am writing a server in linux that is supposed to serve an API.
Initially, I wanted to make it Multi-threaded on a single port, meaning that I'd have multiple threads working on various request received on a single port.
One of my friends told me that it not the way it is supposed to work. He told me that when a request is received,...
I have been trying to solve a problem involving thread communication using wait() and notify(). Basically i have 2 threads T1 and T2 and i want them to be executed in the following order
T1 , T2, T1, T2 ..... How can i achieve that?
Actual Problem: There are 2 threads T1 - which prints odd numbers (say 1 - 100) and T2 - which prints ev...