Most voted "thread" questions
Thread (Thread) is a sequence of programmed instructions that can be managed independently by the OS process scheduler.
Learn more…388 questions
Sort by count of
-
5
votes1
answer555
viewsSome questions about socket
I’m taking a look at an example of microsoft itself and I’m having some doubts. Example taken from this link: https://msdn.microsoft.com/pt-br/library/bew39x2a(v=vs.110). aspx Let’s imagine a chat…
-
5
votes1
answer1242
viewsAre there differences between the terms Thread, Multithread, Async and Await?
I asked that question here at Stack Ooverflow: What is the solution for asynchronous PHP processes? I did it because I wanted that in the middle of a process execution, I wanted to have a certain…
terminology thread multithreading async asynchronousasked 7 years, 5 months ago Wallace Maxters 102,340 -
5
votes2
answers156
viewsExecution of programs in pararelo WITHOUT use of Threads
They ask me to develop a Java program, to run programs (ls, firefox) in parallel that are contained in a file. For now I have the following code: File file = new File()`; List<String> lista =…
-
5
votes1
answer456
viewsUsing C# Threads for the First Time
I’m trying to make use of C# Threads for the first time, I’m a beginner in the subject, so I’m sorry for the question if it’s too basic. I am using the code below to use such procedure: private…
-
5
votes1
answer351
viewsSecondary thread on flutter
Hello, I have the following problem in flutter: I currently have an application with the plugin flutter_background_geolocation based on the example that is provided by the plugin. While performing…
-
4
votes1
answer491
viewsHow to create a Managed Thread in C++ similar to the example in C#
In C# I use the following code to create Managed Thread: Thread thread = new Thread(new ThreadStart(minhaFuncao)); In C++ i made: using namespace System::Threading; . . Thread^ thread = gcnew…
-
4
votes1
answer2247
viewsHow to stop a Thread for a certain time without using a Timer?
Explanation: Next, I have a TThread running parallel to Main Thread. And I have a routine to give fade image. Well, the important thing is that I realize this fade in a given time in milliseconds,…
-
4
votes1
answer1055
viewsHow to implement a thread queue to run one after the other?
I have a static method to record logs on my system. public class Logger { public static void SaveLog(string[] lines) { System.IO.File.WriteAllLines(@"C:\...\Temp\ExceptLog.txt", lines); } } The…
-
4
votes2
answers260
viewsThreads with size set via code
I have a system that at certain times uses more than a thousand threads simultaneous and unfortunately accurate run in environment 32-bits. For default, the Delphi allocates 1kb for each thread new,…
-
4
votes1
answer616
viewsThread problem
public class ThreadTest implements Runnable { private String word; private long time; public ThreadTest(String word,long time){ this.word = word; this.time = time; } public void run() { try {…
-
4
votes1
answer213
viewsRepaint screen every little time without crashing - C++
I have the following situation: I have to repaint the screen every little while so that objects on the screen move on their own, but this has to occur so that the program does not lock. I tried to…
-
4
votes0
answers178
viewsProblem with Ubuntu window focus setting when using Java
I was making a program in which a circle is drawn on the screen and it is walking around the screen, using the classes JFrame to create the window, a thread to control the circle I insert on the…
-
4
votes1
answer366
views -
4
votes2
answers681
viewsHow to display a Toast inside a Thread on Android?
I’m developing an app and I needed to display a Toast at some point within a Thread, but I’m not getting it, does anyone know how it’s possible and if it’s possible to do so? Thank you in advance.…
-
4
votes1
answer57092
viewsHow to resolve java.lang.Nullpointerexception?
I created the class Server! However an Exception of the type is launched java.lang.NullPointerException! I wonder if someone could help me with this problem? The class is as follows: public class…
-
4
votes1
answer614
viewsSeeking Active Threads
I have the following problem, where I have one for() that opens 17 threads and needs to recover, in another thread ( 18ª ) the active threads that I opened earlier and verify which of the 17 are…
-
4
votes1
answer186
viewsc#: using threads in a "windows Forms" project
In my application I have several "subprocesses". They all emit information in which they are displayed in the Form. I used System.Windows.Forms.Timer: Class x { public Timer timer {get; set;} public…
-
4
votes1
answer127
viewsWhy the compiler alerts me Anonymous new Runnable() can be replaced with lambda
Because that code (Thread) shows this message (on the compiler), and how to make it not show more? Code: public void onCreate(Bundle icicle) { ... mVideoView.setOnPreparedListener(new…
-
4
votes2
answers579
viewsTwo threads running the same function
I have a situation where in Delphi I have two threads that perform a function that ping in a Firebird database. I use this to sync data from my PDV (sending and receiving). But as they run at the…
-
4
votes1
answer149
viewsCustomers do not communicate in the same multiplayer game in Java
I’m trying to make a simple tank multiplayer game by implementing chat. The game and the chat are all ok! However, I can’t get 2 customers to view the same object Arena. In this case, each customer…
-
4
votes1
answer225
viewsRatio of threads to number of processors
In the image below my task manager there are 3058 Threads. My processor has 4 threads. This means that of these 3058 it will run 4 in 4 threads? My processor has 4 cores and 4 threads, that means…
-
4
votes1
answer192
viewsParallel Processing Routine C#
I would like to start a data processing method whenever I receive a String with START content through the Transceiver event.Receivelineeventhandler(); but this method will have a processing time as…
-
4
votes2
answers890
viewsHow to add parallelism in execution with the subprocess module?
The code will be used in 2 testing virtual machines (Linux and Windows). The code below works but every time I run a program, for example the notepad, the prompt is stuck until I close the program.…
-
4
votes2
answers992
viewsIs it possible to pass a method as a parameter to run on a thread?
I have an application where each process is called by a single method and this process needs to run in a thread. The code of the threads is identical in all, changing only the content of the method…
-
4
votes2
answers175
viewsShould I make sure the threads end at Dispose?
There are already some questions about the interface IDisposable and the using, for example: What types of resources are released in a statement using I should always use Disposis Still I’m not sure…
-
4
votes3
answers634
viewsHow to make my program consume less CPU without disturbing its execution?
I have a program that reads the memory of a computer process continuously (with the while (true)), but it ends up requiring a lot of CPU, arriving at 20% used, my question is, how to decrease CPU…
-
4
votes1
answer83
viewsWhat is the need of a while in a producer-consumer?
I’m used to programming using this while in problems involving synchronization of threds because that’s how API’s usually ask you to do it, but I’ve never wondered why it is. I am taking a course of…
thread multithreading operating-system synchronizationasked 5 years, 9 months ago Michael Pacheco 1,657 -
4
votes2
answers77
viewsUsing integers as Java Locks
I have the following code snippet: class classe{ public static void main(String[] args){ Integer lock = 0; Thread t1 = new Thread(){ public void run(){ // instruções thread sem sincronia…
-
3
votes2
answers429
viewsRun N threads and know when all finished running
I have the following problem, I need to run the same method N times in a for and know when all the threads they’ve finished running it. I needed something like this: foreach (MeuObjeto obj in…
-
3
votes2
answers111
viewsThread in the background when the app is closed
How do I run a Thread with the application closed? That is, so that when the user turns on the device it starts without having to enter the application.
-
3
votes1
answer250
viewsExecute a method with the closed application "Service"
On Android it is possible to send notifications, make queries via http, execute methods, all through a Service without the user need to necessarily run the application, just the fact that the…
-
3
votes2
answers2519
viewsThread containing connection components to the database generates an exception when they are released from memory
I needed to add some threads to carry out certain processes in the background. This thread accesses the methods of a Webservice and also performs operations in the database. I create all the objects…
-
3
votes1
answer184
viewsAsynctask Android
I have a "Runnable" method that executes in a new Thread a certain method to update my list. Every time I call this "Runnable", I’m creating a new Thread, which for me is not very positive... How…
-
3
votes1
answer250
viewsMulti-processing/Multithread not working
I want to try to solve the problem of when the client cannot connect to the server(connection failure, server below, etc). In my main class is the connection to the server and I want in case of…
-
3
votes1
answer425
viewsPopular datagrid with threading
I am contracting a Windows Form application. I am not getting popular my datagrid with a threading, appears the following error: "Invalid threaded operation: control accessed datagrid of a thread in…
-
3
votes2
answers649
viewsJava Scheduleexpression
I’m developing a Nobreaks Supervising Software, I’m using the ScheduleExpression which runs every 5 seconds, followed by code: @PostConstruct public void agendarMonitoramento(){…
-
3
votes0
answers2146
viewsC Client server application for file transfer with TCP socket and thread
I would ask for help from the forum to make secure (encrypt) the transfer of a file between two computers. Below follows the C source code of a client-server application for file transfer using…
-
3
votes1
answer1283
viewsAndroid Studio Error 1.5.1
Good evening, I’m new with Android development and in my first project I’m having error the following error "Exception in thread "png-cruncher_20", just below follows the complete log of the error,…
-
3
votes2
answers1845
viewsHow to recover the return result of a routine from within a Thread?
I need to run a routine within a Thread, and get the return of this method. My code is like this. class Main { public static void main(String[] args) { String resultado = ""; Thread t = new Thread()…
-
3
votes1
answer113
viewsLife of threads in java
When an object, from a class that implements a thread, is destroyed (loses reference) the thread referring to that object will stop?
-
3
votes1
answer860
viewsHow to send multiple requests at the same time
Well my program takes Urls from a text file, enters them and checks if it has a certain text in its HTML code, it would be possible to read all lines of the file, and instead of making a request at…
-
3
votes3
answers682
viewsWhat is the difference between Smtpclient.Sendasync and Smtpclient.Send() using Thread?
What difference between using SmtpClient.SendAsync() and create threads and execute the SmtpClient.Send() for messaging? There is a lot of difference in performance or resource consumption?…
-
3
votes2
answers176
viewsTermination of a Thread
When multiple shots are fired Threads in a specific loop, upon completion of each, the Thread stays open needing a "close" or is automatically finished? for(int i=0;i<=10;i++){ Process ps = new…
-
3
votes1
answer161
viewsHow to receive automatically, in Activity, a value calculated in a Service?
I have an algorithm that generates prime numbers using a Service. Well, it works but I need it to update the data in my Activity automatically, at the moment it does this just by clicking on a…
-
3
votes1
answer3368
viewsImplement Runnable or Thread Extension?
In several Java projects, I’ve seen these two ways to create Threads: With implements Runnable: public class MyRunnable implements Runnable { public void run() { //Código } } //Iniciada com uma…
-
3
votes1
answer227
viewsFire automated e-mail at a certain time with java
My system has the part of dental consultations and I need to send email to the client, if your consultation is on that day. For example: Run an automatic e-mail trigger at midnight every day. This…
-
3
votes1
answer193
viewsHow to measure times in multi-threaded C programs
I’m doing a multi-thread work in c, and I need to calculate the time of a certain part of the program, does anyone have any idea how I can do this?
-
3
votes1
answer1163
viewsCannot evaluate Expression because the Current thread is in a stack overflow state
You’re making that mistake: Cannot evaluate Expression because the Current thread is in a stack overflow state in the variable qtde adding it to the list desci. class descricaoo : IInstrucao {…
-
3
votes1
answer155
viewsUse a Threadpool or just start a new Thread?
Let’s say the software every time creates a new Runnable to perform a basic function at each cycle, at the end of a running day I would have a few hundred Threads of this function created and…
-
3
votes0
answers55
viewsAccessviolationexception When I type ALT or TAB C# WINDOWS FORM
Guys, I have a form where the Form (Plano_aula) calls the form (Call) , in this Form Call has a list of students and a Panel that stays with the Visible = false, in this same screen I call a class…