multithreading

Image Download through thread error

蹲街弑〆低调 提交于 2020-06-11 05:33:51
问题 Happy new year to all StackOverFlow member and readers ! I come to you today for a question regarding threads in Delphi (I browsed most of what was already posted on the subject but could not find a clue). I have a very simple test application with one Form (frmIMGDown) and a thread unit. On the form are found a Tbutton a TImage a TprogressBar When clicked, the button starts a thread that downloads an image from the web, updates the progressbar during the process and displays a downloaded

C++ thread-safe uniform distribution random number generation

大城市里の小女人 提交于 2020-06-11 03:58:46
问题 I have a loop. Inside the loop, in each iteration, I need to draw a number from U[0,1]. How can I use openmp, and also make sure that the random number generating process is not contaminated? I got suggestion that I need a thread-safe random number generator, which may or may not be the solution to my problem. My question is very related to another one, with a slight difference that I want to draw from a coninuum U[0,1]. Additionally, I don't know how to seed generator by thread, can someone

threadpool c++ implementation questions

妖精的绣舞 提交于 2020-06-10 21:24:20
问题 here and here , we can see similar threadpool implementations. my question is about function to add the task to threadpool, these are add and enqueue in projects above respectively. because these look very similar I'm posting a piece of one here (from second project) auto ThreadPool::enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type> { using return_type = typename std::result_of<F(Args...)>::type; auto task = std::make_shared< std::packaged_task<return

threadpool c++ implementation questions

狂风中的少年 提交于 2020-06-10 21:15:05
问题 here and here , we can see similar threadpool implementations. my question is about function to add the task to threadpool, these are add and enqueue in projects above respectively. because these look very similar I'm posting a piece of one here (from second project) auto ThreadPool::enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type> { using return_type = typename std::result_of<F(Args...)>::type; auto task = std::make_shared< std::packaged_task<return

Thread Quantum: How to compute it

放肆的年华 提交于 2020-06-10 06:26:13
问题 I have been reading a few posts and articles regarding thread quanta (here, here and here). Apparently Windows allocate a fix number of CPU ticks for a thread quantum depending on the windows "mode" (server, or something else). However from the last link we can read: (A thread quantum) between 10-200 clock ticks (i.e. 10-200 ms) under Linux, though some granularity is introduced in the calculation Is there any way to compute the quantum length on Linux? Does that make any sense to compute it

Thread Quantum: How to compute it

前提是你 提交于 2020-06-10 06:24:31
问题 I have been reading a few posts and articles regarding thread quanta (here, here and here). Apparently Windows allocate a fix number of CPU ticks for a thread quantum depending on the windows "mode" (server, or something else). However from the last link we can read: (A thread quantum) between 10-200 clock ticks (i.e. 10-200 ms) under Linux, though some granularity is introduced in the calculation Is there any way to compute the quantum length on Linux? Does that make any sense to compute it

Thread Quantum: How to compute it

二次信任 提交于 2020-06-10 06:23:10
问题 I have been reading a few posts and articles regarding thread quanta (here, here and here). Apparently Windows allocate a fix number of CPU ticks for a thread quantum depending on the windows "mode" (server, or something else). However from the last link we can read: (A thread quantum) between 10-200 clock ticks (i.e. 10-200 ms) under Linux, though some granularity is introduced in the calculation Is there any way to compute the quantum length on Linux? Does that make any sense to compute it

Is ConcurrentDictionary Keys or Values property threadsafe

邮差的信 提交于 2020-06-10 02:07:25
问题 Have a question regarding thread safety with ConcurrentDictionary . From the API, I see that the enumerator is thread-safe, but I don't see the same for keys and values properties. My question is: Is it safe to loop over the Keys or Values collection when there are other threads modifying it concurrently? 回答1: While I do like the documentation, I tend to verify things with a small program when in doubt or I feel that I might be assuming too much. The following code verifies that indeed you

What about multithreading in Android SQLite?

戏子无情 提交于 2020-06-09 12:08:09
问题 In my app I've got to implement some UI and Sync service. It runs in the background and updates data. Sync service is not very simple, it uses multithreading. So, here is my story: When I started developing this app I didn't know anything about sqlite, so I just didn't use any thread synchronization in Java. Result: I got many Exceptions like "SQLiteException: database is locked: BEGIN EXCLUSIVE;" Then I synchronized all my transactions with regular Java synchronized () {} block. Everything

Can't invoke button click function() outside pyQT based GUI

ε祈祈猫儿з 提交于 2020-06-09 06:37:48
问题 I am trying to enhance the existing pyQT based GUI framework. The GUI is a multithread GUI based out of pyQT. I have taken some portion of it here to explain the problem GUI.py - main python script that invokes function to create Tab on GUI from TabWidgetClass import ConstructGUITabs class mainWindow(QtGui.QMainWindow): def __init__(self,**kwargs): super().__init__() self.dockList = [] #Lets build&run GUI self.BuildRunGUI() ### initialize GUI def BuildRunGUI(self): ### frame, status