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
-
0
votes1
answer483
viewsHow to return data from a thread to the runtime layout in flutter
There is how to thread using the flutter and return the processing result on the screen? I have the following code. In the main class _Myhomepagestate I have the layout and function _process(). The…
-
0
votes1
answer54
viewsThread Android error that is crashing the app at the time of opening
I’m doing an initial project to test the functionalities of the Speechrecognizer library from google for android, but at the time if climbing the App I’m having problems, in this case it just closes…
-
0
votes0
answers37
viewsVariable value increases +1 within Thread
I am trying to change the color of the Datagrid line and this is easy. However, something is happening with the variable value idxRow2 when this is accessed in the new Thread. The problem is in the…
-
0
votes2
answers68
viewsHow to take what was returned from a Task
I have following code: List<UserItem> items = null; Task taskCreateItems = new Task(() => items = DeliverItems(Session, Item.GetBaseItem(i), (priceAmount * ((Item.Items.Count > 1) ?…
-
0
votes1
answer396
viewsHow to calculate the factorial of a list of integers using thread?
Given an A vector of size N with only positive integers, calculate the factorial of each of them and store the result in a vector B. To calculate the factorial, use the following function: def…
-
0
votes1
answer24
viewsVery fickle output in multithreaded application along with Exception
I’m seeing threads now and doing some experiments. It’s a simple test, I want to print on the console ten times the name of each thread by inserting into the same object of type List in a…
-
0
votes0
answers95
viewsHow to stop a Session?
I am working with Java Swing. I have a report screen, which when it is clicked on the confirm button, it calls the generate method. The generating method goes in control, and the control goes in the…
-
0
votes1
answer73
viewsHow to create parallelism in a specific multithreading?
My scenario is this:: Simulate a water tank associated with two taps: one used to fill the tank and another used to empty the tank. Rules: a) The total capacity of the tank is 2000 liters and each…
-
0
votes1
answer29
viewsinstance continues running even after being closed by a thread
Good even after closing my instance it keeps running because of a thread I created to call a while: public void nativeKeyPressed(NativeKeyEvent event) { System.out.println("Key Pressed: " +…
-
0
votes2
answers259
viewsC# - Can you run a task and return to the main thread later?
in the case the whole program is written without task and only one excerpt is with task, I wanted after that piece it returned to the "main thread". The code below is inside a for, and serves to…
-
0
votes1
answer90
viewsThreads do not run - Python
I need to allocate several threads to process a given data array. However, regardless of the number of threads I allocate, one of them is always unexecuted (usually the first). Follows code snippet:…
-
0
votes1
answer40
viewsHow to correctly receive an argument by creating a thread
I’m trying to create a thread to wait a while and then create a second thread using: pthread_create(&thread_intermedia, NULL, criar_thread, &init); where init is an integer, let’s say it is…
-
0
votes1
answer155
viewsInteraction between Threads in Python, error message " Object is not callable"?
I am doing the interaction of 4 Threads, but when running them at the same time appears the following message: Object is not callable That is, the object cannot be called. How to fix it? Follow the…
-
0
votes1
answer951
viewsThread error: Control accessed from a thread that is not the one in which it was created
I have a code pad and I need it to run every x seconds, so I used the class Timer and passed as parameter the method I want to execute, and the times, start and interval. However the code is popping…
-
0
votes1
answer102
viewsHow to pause a thread and run another thread?
Hello, I need to understand how to get a thread to pause its execution and another thread to start running? I have the following code snippet: import java.util.concurrent.Semaphore; public class…
-
0
votes0
answers60
viewsHow to decrease running time using openmp
I wanted to know what I can do to decrease the running time using Openmp threads. I made a code to add the values of a size 2² vector, but the time measures are practically equal when I increase the…
-
0
votes2
answers67
viewsHow to pause Thread while Alert runs within Platform.runLater - Javafx Java
I need to execute a method within a Thread that contains Alert and Dialog. As you already know Javafx has the limitation of not being able to show Alert or Dialog inside a Thread, so I put them…
-
0
votes1
answer92
viewsWhat is the difference between passing nil in Synchronize/What is the difference between a Task/Thread?
In most examples I found the structure of a basic Task is: procedure var FTask : ITask; begin FTask := TTask.Run( procedure begin //código a ser executado dentro da Task;…
-
0
votes0
answers21
viewsMy thread does not wait for code execution to finish and restarts
Thus, the following thread needs to be always running so that if the READ TEXT button is activated (it is a swicth), the Voice class that reads the text on the screen is executed, as well as if the…
-
0
votes1
answer124
viewsHow do I call an asynchronous corotine within a function that is initialized into a thread?
import telepot, time, threading, asyncio from telepot.loop import MessageLoop from datetime import datetime from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, InlineKeyboardMarkup,…
-
0
votes0
answers74
viewsAnd python how to stop a specific thread (or all) in while loop
How to stop one, or all threads in python by ID (example) I’m developing a program that should run some loops looking for information in real time. However, when any of them find something the…
-
0
votes0
answers19
viewsHow to close a python thread at the end of the "target" run
I think I’m having problems in my python program, by the amount of Threads generated and I’m not sure how to deal with it. Below is an excerpt of the code where N Threads are created to run the same…
-
0
votes1
answer39
viewsHow to run widgets that use Qtimer from a different Thread?
I created an application where the user presses a certain key combination - using the package pynput - and a message from a "Qtoaster" appears on screen. Below is an example code: from pynput import…
-
-1
votes1
answer61
viewsCode error repeating values in threads?
#include <pthread.h> #include <stdio.h> void *Operacao(void *soma) { int n; printf(“Digite o primeiro numero:”); scanf("%d", &n); printf(“Digite o segundo numero:”); scanf("%d",…
-
-1
votes1
answer131
viewsProblems with three Forms and picture box
Hi, here’s my scenario: - Configuration form (name, e-mail and a photo) - ABC form - which has a form that opens by clicking on a ABC form button - BCA form - which has a form that opens by clicking…
-
-1
votes1
answer265
viewsHow to run an application on multiple Threads?
I’m developing an interface application by Swing. The application aims to simulate a computer network in which I will monitor using the implementation InetAddress. Well, I created my interface,…
-
-1
votes1
answer39
viewsFuture call with Void type
Situation I needed to print a PDF report through a void method that returned Replay and after screen printing it became necessary to invalidate the permission key directly in the bank. Problem Soon…
-
-1
votes1
answer209
viewsUsing threads in classes
Hello, I have a problem regarding the use of threads. Once I use mingw to compile my projects, and this header is not implemented, I use this header to compile my projects. However, I am having some…
-
-1
votes1
answer254
viewsProgressibar using Threads and Scenebiulder
I’m doing a job, and I wanted to know in a simple way how I solve this, I’m doing a simple program in which it’s almost a game, basically you push a button, the progress bar starts to grow, and adds…
-
-1
votes2
answers375
viewsCalling another class method in a Task c#
I’m trying to make a task call from a method of another Class: Diretorios diretorios = new Diretorios(); await Task.Run(() => diretorios.CopiaDiretorios(tbxVersaoAtual.Text,…
-
-1
votes1
answer176
viewsTraverse a vector by dividing the search into threads
Hello, I have a problem, I have a college assignment where I have a very large vector, where I have to get each processor thread through a part of that vector increasing the speed of the search, but…
-
-1
votes1
answer27
viewsMove form control with Thread
I’m trying to make a little 2D game, in it when the character moves the walls also move in a way that looks like some kind of game, however using timers would be a bad idea because when I add too…
-
-2
votes1
answer101
viewsThreads in Java
This is the first time I’ve been working with Threads. I created two threads, one to run the report generator (iReport) and one to operate a progress bar (Jprogressbar). However, even using flag,…
-
-2
votes1
answer39
viewsHow can I use more than one function in the same Thread?(python)
I already tried that but it says that the is not defined: import threading as te import time b=[] def c(): global a a=0 while b==[]: time.sleep(0.001) a+=0.001 def i(): b.append(input('enter'))…
-
-2
votes1
answer4784
viewsException error in thread "main" java.lang.Nullpointerexception
So I’m trying to make a program that adds 2 vectors via Thread, but he makes the following mistake: Exception in thread "main" java.lang.Nullpointerexception At Soma. (Main.java:37) At…
-
-2
votes1
answer993
viewsHow to terminate a script with Python threads
I am working with a project and need the user to have the option to terminate it at any time, the cleanest way to do this I have found so far was by the process manager terminating the python…
-
-2
votes2
answers53
viewsHow to check if a variable received a new python value?
I have a Thread from a function that inserts data into the database and another Thread that every second receives a new value for a variable, however it may be the same previous value only "new". I…
-
-3
votes2
answers522
viewsHow to query a bank from a thread?
A teacher asked to develop a project (a CRUD of cars). I’ve done the part of inserting, removing, listing and changing. But the listing part should be done by a thread (teacher requirement), in…