multithreading

Server-side performing multiple requests against cloud services

蹲街弑〆低调 提交于 2020-01-23 12:12:20
问题 I am in the process of writing a web-app that uses multiple web APIs. For a single request of a single user, my app may need to perform up to 30 HTTP requests to other sites. The site housing the web-app can have hundreds of concurrent users. I've been looking around trying to figure out which library should I use. I'm looking for a mature project that has detailed documentation and tested code, one that will still be around in years to come. Not sure if something like that exists (!) Couple

Merging the results of two background workers upon completion

自古美人都是妖i 提交于 2020-01-23 11:12:48
问题 i have two background threads Worker = new BackgroundWorker(); Worker.DoWork += new DoWorkEventHandler(GetQuery); Worker.RunWorkerCompleted += GetQuery_RunWorkerCompleted; Worker.RunWorkerAsync(); Worker2012 = new BackgroundWorker(); Worker2012.DoWork += new DoWorkEventHandler(GetQuery2012); Worker2012.RunWorkerCompleted += GetQuery2012_RunWorkerCompleted; Worker2012.RunWorkerAsync(); both the methods in worker threads are returning data tables now my task is i need to merge those two data

Merging the results of two background workers upon completion

浪尽此生 提交于 2020-01-23 11:12:44
问题 i have two background threads Worker = new BackgroundWorker(); Worker.DoWork += new DoWorkEventHandler(GetQuery); Worker.RunWorkerCompleted += GetQuery_RunWorkerCompleted; Worker.RunWorkerAsync(); Worker2012 = new BackgroundWorker(); Worker2012.DoWork += new DoWorkEventHandler(GetQuery2012); Worker2012.RunWorkerCompleted += GetQuery2012_RunWorkerCompleted; Worker2012.RunWorkerAsync(); both the methods in worker threads are returning data tables now my task is i need to merge those two data

Merging the results of two background workers upon completion

99封情书 提交于 2020-01-23 11:11:59
问题 i have two background threads Worker = new BackgroundWorker(); Worker.DoWork += new DoWorkEventHandler(GetQuery); Worker.RunWorkerCompleted += GetQuery_RunWorkerCompleted; Worker.RunWorkerAsync(); Worker2012 = new BackgroundWorker(); Worker2012.DoWork += new DoWorkEventHandler(GetQuery2012); Worker2012.RunWorkerCompleted += GetQuery2012_RunWorkerCompleted; Worker2012.RunWorkerAsync(); both the methods in worker threads are returning data tables now my task is i need to merge those two data

Threads and Asynctask task use for httppost

不羁的心 提交于 2020-01-23 11:02:20
问题 Friends ,i need help to android httppost data to server using Asynctask or Threads I need to send data to my server when i click post button.But when i click it app need to go to next page and data need to send through as background process.I'm new to Android.I don't know what is exactly use for this kind of task (Threads or Asyanctask). I tried this code but it will give me exception error public void startProgress(final String name) { // Do something long Runnable runnable = new Runnable()

How long does a context switch take in Linux?

坚强是说给别人听的谎言 提交于 2020-01-23 10:43:06
问题 I'm curious how many cycles it takes to change contexts in Linux. I'm specifically using an E5405 Xeon (x64), but I'd love to see how it compares to other platforms as well. 回答1: There`s a free app called LMBench written by Larry McVoy and friends. It provides a bunch of OS & HW benchmarks One of the tests is called lat_ctx and it measures contex switch latencies. Google for lmbench and check for yourself on your own HW. Its the only way to get a number meaningful to you. Gilad 回答2: Run

Thread Setup for GLFW

心已入冬 提交于 2020-01-23 09:04:04
问题 I started working with the new Lwjgl 3 which uses GLFW for its Display/mouse/keyboard handling and I'm really liking it! However today i hit a brick. I had a simple rendering animation going but when I dragged the screen it stopped rendering until i let go again. According to: http://www.glfw.org/faq.html The problem arises due to windows. 3.5 - Why does my application freeze when I move or resize the window? The Windows event loop is blocked by certain actions like dragging or resizing a

C++11 thread doesn't work with virtual member function

荒凉一梦 提交于 2020-01-23 08:30:28
问题 I'm trying to get a class run a thread, which will call a virtual member function named Tick() in a loop. Then I tried to derive a class and override the base::Tick(). but when execute, the program just call the base class's Tick instead of override one. any solutions? #include <iostream> #include <atomic> #include <thread> #include <chrono> using namespace std; class Runnable { public: Runnable() : running_(ATOMIC_VAR_INIT(false)) { } ~Runnable() { if (running_) thread_.join(); } void Stop()

Array of threads?

风流意气都作罢 提交于 2020-01-23 07:30:11
问题 So I am having an issue understanding how to avoid sequential execution of threads. I am attempting to create an array of threads and execute the start() and join() functions in separate loops. Here's a code example of what I have now: private static int[] w; static class wThreads implements Runnable { private final int i; public wThreads(int i) { this.i = i; } //Set member values to 1 @Override public void run() { //doing specific stuff here } } And here's where the threads are created in

Real life use and explanation of the AtomicLongFieldUpdate class

烂漫一生 提交于 2020-01-23 07:21:49
问题 Is anybody aware of any real life use of the class AtomicLongFieldUpdate? I have read the description but I have not quite grasped the meaning of it. Why do I want to know that? Curiosity and for OCPJP preparation. Thanks in advance. 回答1: You can think of a cost ladder for the following: ordinary long : cheap, but unsafe for multi-threaded access volatile long : more expensive, safe for multi-threaded access, atomic operations not possible AtomicLong : most expensive, safe for multi-threaded