Questions tagged [thread-synchronization]

In a multi-threaded environment thread synchronization is used to coordinate access to shared resources such as file handles, network connections, and memory

In a multi-threaded environment thread synchronization is used to coordinate access to shared resources such as file handles, network connections, and memory

References

645 questions
-1
votes
2 answers

Bank Account/User Application: Multi-threading and Synchronization

for my current uni coursework, I'm meant to create a Java console application that simulates the creation of a Shared Bank Account which a maximum of 4 users have access to simultaneously. With all the resources and other multi-threading…
-1
votes
1 answer

How can I execute 3 threads in this order?

I got a problem. I've tried for several days to execute 3 threads in this order in C: Thread 1 Thread 3 Thread 1 Thread 2 Thread 1 I use condition variables. This is my code, and just print: Thread 1 Thread 3 And it stays blocked #include…
-1
votes
1 answer

Java factorial calculation with threads

I am trying to calculate the factorial of very large numbers using threads but the threadless function is calculating faster.How can i use parallel computing with…
-1
votes
1 answer

Threading and updating the GUI

I've been working on a WinForms utility that takes commands and/or data from a text file and based on the contents of this file transmits or requests further data over serial. This all works perfectly but I am struggling with working out how to get…
-1
votes
1 answer

Detecting variable change as soon as possible

First of all, this has to do with homework. Just a little hint would be enough. What I have to do is to detect when a variable(signal) has changed and announce it in 1 microsecond or less. My progress so far: int main(int argc, char **argv) { int…
-1
votes
1 answer

can ayone what is happening at the background

package workouts; public class synchro { private int count = 0; public void counting() { Thread T1 = new Thread(new Runnable() { @Override public void run() { for (int i = 0; i < 10000;…
sritharan
  • 41
  • 1
  • 10
-1
votes
1 answer

Only one thread is iterating through the ArrayList in java

I have written a code below in which there is list of Employee object in which i have three attributes employeeId,employeeName and salary i am iterating the list using two threads and doing increment of salary by 100. but when this code executes…
ZohebSiddiqui
  • 209
  • 3
  • 4
  • 14
-1
votes
5 answers

Android - Calling functions in the wrong order

First, in my application I'm calling that code : String login = e1.getText().toString(); String password = e2.getText().toString(); login = login.replace(" " , ""); password =…
TN888
  • 7,659
  • 9
  • 48
  • 84
-1
votes
2 answers

Concurrency among C# threads

The scenario is the following one: public class MainClass { private static Object common_object; protected int Method_A() { //... lock (common_object) { // Works with common_object; …
-1
votes
1 answer

Will this be a non-interference in a multi-threaded environment?

std::deque dq; Thread_function(pointer to queue as argument) // created 8 threads { vertext_found = true; **v is initialized to NULL while ( i < dq->size()) { EnterCriticalSection(&h); if( i < dq.size()…
Sumanth
  • 595
  • 3
  • 14
  • 39
-2
votes
1 answer

How can I stop the UI thread that is taking too long with a stop button press in C#

I have a windows form that has (among other things) a Start and a Stop button. If the Start button_click code takes too long, I'd like to press the stop button (or some other event) that will allow me to stop that code from completing. The…
mdmenard
  • 183
  • 1
  • 1
  • 9
-2
votes
1 answer

Is it useful to use C# lock in those simple cases?

In a multithreaded environment, locking on thread-sensitive resources is important. I often assume collections and such are thread-unsafe, depending on MS documentation, but are simple types thread sensitive too? Let's take examples. Is it useful to…
-2
votes
1 answer

What are the equivalent functions in the JNI env for pthread_cond_broadcast() and pthread_cond_timedwait()?

After reading through this I now understand how to synchronize thread's critical sections on the native side of the JNI. However, I cannot find equivalent functions for these 2 pthread calls: pthread_cond_timedwait() and pthread_cond_broadcast() I…
-2
votes
1 answer

Multiple Browser Instance of unique profiles using CreateProcess() is not giving expected output

I have multiple profiles in Chrome.Profile names are like - Profile 0,Profile 1,.... I am Opening multiple chrome instance with unique profile using CreateProcess(). After that I am assigning each process a thread using CreateThread().Now if i want…
-2
votes
2 answers

Is it possible, in a conceptual level, to realize distribute computing in an assembly/compiled code level?

The goal of this question is to ask if it is possible to have some compiled code (think in terms of an ordinary program, not necessarily written in any special way [e.g multi-threaded] or in any particular paradigm/language) being sent through the…
1 2 3
42
43