multithreading

Stack and Stack Base Address

In the MEMORY_BASIC_INFORMATION structure one finds two PVOID variables, called BaseAddress and AllocationBaserespectively. I'm reading a book on Threading and its going over how to get the stackspace left on the stack in quite some detail, however there's something I'm not sure I understand correctly. The BaseAddress in the structure ...

Parallel/Multithread in CMD

I need to run a counter and a timer at the same time, but I'm not sure about how to achieve it. I have a batch file that counts the number of times any key is pressed in an easy loop made by a goto, once its done (keypress) for the first time, it fires a timer for 1 min; the key pressed in that time, must be stored in another variable...

.NET Threadpool worker threads and asynchronous IO threads

OK, as I understand it, the .NET Threadpool maintains a number of background threads ready to be used for tasks of some kind. The Get/SetMinThreads and Get/SetMaxThreads methods contain two parameters that can be returned or adjusted. According to MSDN the two parameters indicate the number of worker threads and the number of threads ...

C++/Qt enum - should I use locking to share the value across threads?

I have a C++/Qt QThread worker thread, which stores its current status as an ENUM (e.g. values such as Working, Finished). Only the worker thread sets the ENUM. I need to be able to read the status of the worker thread from another thread (the GUI thread), to display on the screen whether work is being done. Is it safe to read/write th...

Java Pause Execution

I have a pool of threads which are working independently. Basically these threads are getting data from websites. I have also another thread which change my System IP. I just need to pause all other threads while another thread is changing ip. As soon as ip will change then other threads pool will resume. Is there any solution? Here is...

How to Delete Entries In Static Dictionary When Not Used

I have a static class that holds a dictionary of objects. I have multiple threads that access this dictionary and create objects on it that are specific to that thread. How and when can I remove entries from the dictionary when a thread is "done"? Basically this is a static class for an ASP.NET application that all requests can have "is...

Handling multiple updates to the same row at the same time in an asp.net mvc website using linq to sql

I am using linq to sql as ORM for my asp.net mvc website. I dont know how will linq to sql behave in the following situation. Suppose one of the action from a active session, modifies a row of a table and before saving the changes to the database, I mean before calling _db.SubmitChanges() another action from some other session tries to...

Wait cursor on thread control

I have created three checkbox controls for three threads and each would start by checking a checkbox control. When a user unchecks a checkbox, I want to turn on the Wait Cursor on the other thread controls rather than completely disabling them for an instance of time, letting a particular thread to stop. How would you set a IDC_WAIT cur...

java thread pool keep running

This is more a generic question than a specific one. I'm trying to have a multi threaded environment that stays active so that I can just submit tasks and run them. I want to do this without the hassle of executing in a web server or application server. The idea was to use a java thread pool for this, but the issue here is that the pool ...

.Net async Socket multi-threaded sending

hello stack overflow! i have a socket, im using to send large buffers through, if ill do something like // may be accsed form a a lot of threads void Send(byte[] buffer) { m_socket.BeginSend(buffer ... , SendCallback); } void SendCallback() { m_socket.EndSend() // if not done sending- send the reset m_socket.BeginSend() } m...

Update JProgressBar

I can't update my progressbar... this is my code Thread t=new Thread(new Runnable(){ public void run(){ int i=1; jProgBar.setMinimum(0); jProgBar.setMaximum(100); try { while(i<=100 || true){ jProgBar.setValue(i); i++; ...

How to process files a directory using C# multithreading

Hi, I have a C# application that downloads a list of .xml files from an on-line data warehouse. This application dumps the files into a local directory and it takes roughly 1 hour before all 10k files have downloaded. This is a daily process. I need to take each of these files and extract, transform and load the contained data to a da...

GDkPixBufAnimation load problem

Hello, I need to run function in another thread then main form: I have a job_func: void job_func(GIOSchedulerJob *job, GCancellable *cancellable, gpointer user_data) { MainWin* mw = (MainWin*)user_data; while( g_cancellable_is_cancelled(mw->generator_cancellable) == FALSE) { loading (NULL, mw); } } Then load...

How to make several Threads in Java?

I am having a program of chat written on Java and using one Thread,one client and several clients that could come up online and disconect. Every new user can see and talk to everyone and everyone sees him. Now,I search a way of making several conversetion there. Something like: the first one and second one are in a private room,the third...

GFLW threading tutorials

Hi everyone , i'm looking for some tutorials about Threads in GLFW ...

Can you monitor SQL server to tell exactly what queries it has been running?

Can you monitor SQL server to tell exactly what queries it is running? We have an application that is exhausting the application pool. A server administrator has sent us a report from Debug Diag [http://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;displaylang=en][1] which shows threads runni...

Is it safe for multiple threads to call the same function?

Is it safe to for example do: void AddTwo(int &num) { num +=2; } void ThreadProc(lpvoid arg) { AddTwo((int)arg); } Would it be safe for this to occur if 4 threads were doing this at the same time? Thanks ...

Handling a save on a separate thread

I've got a class that contains (among many other things) a list of items that needs to be saved to disk as often as realistically possible. In order to allow this, whenever any change is made, it uses a timer to delay saving to disk by half a second, and if any further changes happen within that half second, it delays the timer; in other...

Do C# 4.0 BCL SpinLock's spin/block when they can't get a lock ?

Hi, Given the following code: ... private static SpinLock logLock = new SpinLock(false); ... private static void ThreadFunc() { bool lockTaken = false; logLock.Enter(ref lockTaken) { try { // do stuff with during an acquired SpinLock } finally { logLock.Exit()...

How to write interruptable methods

I have a method which, conceptually, looks something like: Object f(Object o1) { Object o2 = longProcess1(o1); Object o3 = longProcess2(o2); return longProcess3(o3); } Where the processes themselves might also be compound: Object longProcess1(Object o1) { Object o2 = longSubProcess1(o1); return longSubProcess2(o2)...