multithreading

QRunnable trying to abort a task

怎甘沉沦 提交于 2020-01-16 08:04:09
问题 Is it possible to abort a QRunnable task? I can't find any way to do it even in the documentation. Thanks a lot 回答1: No, you cannot abort a QRunnable task. The only way to dirty-abort a thread in Qt is through QThread::terminate() (which is discouraged). QThreadPool uses QThread behind-the-scenes to run QRunnable tasks, but it doesn't provide a way for developers to call QThread::terminate() . Therefore, QRunnable cannot be aborted. I recommend redesigning your application -- refer to

JPanel with a specific JRadioButton does not update after getting result from SwingWorker thread

喜夏-厌秋 提交于 2020-01-16 06:31:27
问题 I am making a Java GUI application. For reading two types of files required as an input, I am using the SwingWorker class which performs the operation in two different background threads. Once, the two types of files are read, there are a lot of components which get updated in the GUI with data and a HeatMap in one of the JPanel . This JPanel contains two JRadioButton , which on switching should display the two different heat maps obtained from the two files read by the application. I can see

Introduce a text in a lineEdit of PyQt from a thread

北城以北 提交于 2020-01-16 06:24:56
问题 How can I introduce a text in a lineEdit from a thread that are getting the data whithout colapse the program? The important line is in the class "fil" where it shows Principal.self.aplicacio.actual_lineEdit.setText(self.temp) # !/usr/bin/env python # -*- coding: utf-8 -*- import sys import serial import threading from time import sleep from PyQt4 import QtCore, QtGui from temperaturaUI import Ui_Form class Principal(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self

How to Handle Threading for WebBrowser Control

半腔热情 提交于 2020-01-16 05:46:12
问题 I am using BrowserControl to navigate to range of web pages on a site and then parse the html and extract information about books etc… I am having problems related (I think) to threading… I have something like this. // MAIN LOOP for (int i = 0; i < NumberOfPages; i++) { WebBrowser.Navigate("http://AWebSite/" + NumberOfPages.ToString()); } // HANDLE ON_LOADED EVENT void WebBrowser_LoadCompleted(object sender, NavigationEventArgs e) { // Retrieve HTMLDocument, Parse it etc } Now since it takes

Work around Hibernate's errors in multithreaded applications

≯℡__Kan透↙ 提交于 2020-01-16 05:18:25
问题 Because of all the problems we can meet when trying to use Hibernate in a multithreaded application (1st clue, 2nd clue, 3rd clue, etc.), I was thinking of another solution: implementing the logical part within a classic Controller , and simply call it from my thread using URL.openConnection() . In other words, instead of doing something like this: MyThread.java public class MyThread implements Runnable { @Override public void run() { // do some great stuff with Hibernate } } Anywhere.java

Can a child thread of parent GUI dialog thread create a child window?

不问归期 提交于 2020-01-16 05:13:08
问题 Can you create a child window from a secondary child thread or it must be created from GUI thread? Assuming the life time of child thread is until the end of program. 回答1: Unlike other operating systems, each thread in windows can host its own message pump, and thus windows. Care must be taken as child windows need to communicate synchronously with their parent - so you must take care to ensure that neither thread holds a critical section or synchronous object while calling an window API that

Why asyncio.get_event_loop method checks if the current thread is the main thread?

╄→гoц情女王★ 提交于 2020-01-16 05:09:23
问题 Why get_event_loop method in asyncio (source) is checking if the current thread is the main thread (see my comment in the snippet below)? def get_event_loop(self): """Get the event loop. This may be None or an instance of EventLoop. """ if (self._local._loop is None and not self._local._set_called and isinstance(threading.current_thread(), threading._MainThread)): # <- I mean this thing here self.set_event_loop(self.new_event_loop()) if self._local._loop is None: raise RuntimeError('There is

multi threading on asp.net

这一生的挚爱 提交于 2020-01-16 05:00:05
问题 I have not used multi threading much for asp.net. I have a web application that uploads a large temp file to folder. I would like to take that temp file and do some other things with it after it is uploaded. Can I do this work on another thread without the user being on the website any more? Thanks for any help or suggestions. 1.User post large file 2.uploading temp to server 3.After upload completes. I would like to run another thread/worker that can run without any user iteration but is

Scala Parallel Collections: How to know and configure the number of threads

牧云@^-^@ 提交于 2020-01-16 04:11:07
问题 I am using scala parallel collections. val largeList = list.par.map(x => largeComputation(x)).toList It is blazing fast, but I have a feeling that I may run into out-of-memory issues if we run too may "largeComputation" in parallel. Therefore when testing, I would like to know how many threads is the parallel collection using and if-need-be, how can I configure the number of threads for the parallel collections. 回答1: Here is a piece of scaladoc where they explain how to change the task

incorrect output with TBB pipeline

怎甘沉沦 提交于 2020-01-16 03:52:24
问题 I have written a C structure with different values (100 times) in text files such as 1.txt, 2.txt ... 100.txt I am using Intel TBB on Linux. I have created: InputFilter (serial_in_order MODE) TransformFIlter (serial_in_order MODE) OutputFilter (Serial_in_order MODE) The InputFilter reads structure from a file and passes it to TransformFilter. The TrasnformFilter updates the structure values and passes it to OutputFilter. The OutputFilter writes the new structure on the disc. Basically, it is