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
0
votes
0 answers

Change Overrided Method to Single-Threaded

How can I create an overrided method where the method is forced to be single-threaded (not async) when originally it was multi-threaded? Specifically I am trying to avoid a "dequeueOutputBuffer can't be used in async mode" error in Grafika's…
0
votes
0 answers

Deadlock in this method?

While going through the Unreliable guide to locking, I found this line Deadlocks are problematic, but not as bad as data corruption. Code which grabs a read lock, searches a list, fails to find what it wants, drops the read lock, grabs a write lock…
0
votes
1 answer

Sychronization of periodic update and create, update and delete operation

I use Flowable chain for periodic call of request (API) for tasks of users. Flowable.interval(60, TimeUnit.SECONDS) .flatMapCompletable(_tick -> mUserRepository.getAllUsers() .flatMapObservable(Observable::fromIterable) .flatMap(user…
elnino
  • 235
  • 3
  • 12
0
votes
1 answer

Why these while loops do not working in Interthread Communication?

I encountered following code in my java book.I think while loop is useless, the program will not run the while loop because of the valueSet.I debug these code step by step it did not enter while loops. Why we type these while loops? get() while …
my-lord
  • 2,453
  • 3
  • 12
  • 26
0
votes
0 answers

Wait for AutoResetEvent or Thread (ended) in C#

What is the correct way in C# to wait for one of these events, which comes first: an AutoResetEvent is set or another Thread is ended? To wait for multiple wait handles can be used WaitHandle.WaitAny. But Thread is not WaitHandle. Example: class…
gindi
  • 9
  • 2
0
votes
2 answers

Jmeter - running multiple threads using different author token

I have created a thread with three steps to: Access token request: it generates a token to be used in step three. This token is stored in a property ${__setProperty(accessToken,${accessToken})} Logon Get request to hit a url Logon Post request,…
0
votes
3 answers

Update a shared variable from all the threads

I am new to multithreading. I have a volatile variable currentPrimeNo and it will print the next prime number as implemented in run method for every new thread. But everytime I am getting currentPrimeNo as 0 for every thread. How should I keep the…
0
votes
1 answer

What's the correct Ruby pattern for waiting for a background thread to start?

I need to write a Ruby program that executes a background program, and performs some functionality on it. Before doing any operation, the main thread needs to make sure that the background thread is started. What the correct pattern? This is not…
Marcus
  • 5,104
  • 2
  • 28
  • 24
0
votes
1 answer

Thread.join is not working

I want to execute the following threads, and wait for them to finish in order to continue working, However, this is not achieved through my code and I don't know why, I suppose join should force the current thread to wait for all threads to…
Ahmed Khairy
  • 145
  • 2
  • 16
0
votes
1 answer

Opencl: global thread synchronization between two loops

I have an opencl kernel that computes two global buffers in two loops. The first loop does some computations with a global thread and writes the result to the output buffer "OutBuff". Then the second loop updates the values of the global buffer…
0
votes
0 answers

Cannot find symbol, compile error while creating threads

I am stuck in this problem, it works fine in my IDE but has compile errors in the online compiler where i'm submitting my code. Please help. Write a multi threaded Java program to implement Producer and Consumer. Span two thread for producer and…
0
votes
0 answers

Synchronized List keeps locking permanently

I have created a Server with ServerSocket and any connection made is put into a List of Connection. The list is synchronized (Collections.synchronizedList(new ArrayList())), and I access it properly such…
Forseth11
  • 1,418
  • 1
  • 12
  • 21
0
votes
1 answer

Right way to concurrently process std::stack

This might be a basic question in terms of multithreaded programming but I really want to achieve the following without any concurrent data structure. Consider the code: class A { std::stack s; public: A() { s.push(7);…
ampawd
  • 968
  • 8
  • 26
0
votes
1 answer

c# how to make a synchronized timer with a web service

I am making a multiplayer game in c# windows form application with web service which is requires us to put a timer on the gameform, so that when the countdown timer becomes 0, it would be the opponent's turn. Now, this is my timer code. private void…
0
votes
1 answer

How to show waiting Gif image during form load event

i have one form which is doing some long process on form load event, So i want to show One Gif image "Please Wait" during form load event. below is code. private void frmWaitShow() { try { …