multithreading

Timed events overlapping during execution

眉间皱痕 提交于 2020-01-17 05:23:04
问题 I am having an issue with the a Service I used to perform automated tasks. The service uses a Timer and executes after 20 seconds. The function that is executed opens the database, reads from it, sends the values through the network, receives a response and updates the database with that response. Its been working well until I wanted to carry out the automated tasks for about 1000 rows in the database and the system 'failed'. After checking my logs, I found out that the function executes

Update WPF DataGrid ItemSource from Another Thread in PowerShell

孤人 提交于 2020-01-17 05:08:11
问题 I have datagrid that gets updated when a button is clicked. However in some cases the data is taking 30 seconds+ to return and the Window freezes. I want to be able to get the data and populate the datagrid from another thread so as not to hang the main window. The DataGrid is read only. Eventually want to have a "cancel" button and animation to indicate progress, but for now just want to get this working. I made a sample program that can demonstrate the issue, which was based on http://learn

Update WPF DataGrid ItemSource from Another Thread in PowerShell

℡╲_俬逩灬. 提交于 2020-01-17 05:08:03
问题 I have datagrid that gets updated when a button is clicked. However in some cases the data is taking 30 seconds+ to return and the Window freezes. I want to be able to get the data and populate the datagrid from another thread so as not to hang the main window. The DataGrid is read only. Eventually want to have a "cancel" button and animation to indicate progress, but for now just want to get this working. I made a sample program that can demonstrate the issue, which was based on http://learn

Blackberry background listener thread

三世轮回 提交于 2020-01-17 04:51:06
问题 Hey everyone! I am new to blackberry programming although I do have some java experience, with c# being my main language). What I am trying to do is write a thread that will run on system startup and exist in the background as a listener. I would like my app to implement KeyListener and basically sit in the background while the phone is on and track a histogram of how many times each button has been pressed. I'm currently running on the simulator so for now I'm just going to have it print to

How to display a loading screen while doing heavy computing in Android?

China☆狼群 提交于 2020-01-17 04:30:46
问题 I am working on a program that searches the users phone for some date, which takes about 2-3 seconds. While it's computing I want to display a loading screen, so the user knows something indeed is happening. However, when I try to display a loading screen before the computations, nothing is displayed on the screen. This is what I have: ProgressDialog loading= new ProgressDialog(this); loading.setTitle("Loading"); loading.setMessage("Please wait..."); loading.show(); //search stuff loading

Multithreading takes more time than Sequential Execution in C#

六眼飞鱼酱① 提交于 2020-01-17 04:06:27
问题 I am using Multithreading in my while loop , as while(reader.read()) { string Number= (reader["Num"] != DBNull.Value) ? reader["Num"].ToString() : string.Empty; threadarray[RowCount] = new Thread(() => { object ID= (from r in Datasetds.Tables[0].AsEnumerable() where r.Field<string>("Num") == Number select r.Field<int>("ID")).First<int>(); }); threadarray[RowCount].Start(); RowCount++; } But with sequential execution ,for 200 readers it just takes 0.4 s but with threading it takes 1.1 sec...

Wait cursor on thread control

早过忘川 提交于 2020-01-17 03:44:18
问题 I have created three checkbox controls for three threads and each would start by checking a checkbox control. When a user unchecks a checkbox, I want to turn on the Wait Cursor on the other thread controls rather than completely disabling them for an instance of time, letting a particular thread to stop. How would you set a IDC_WAIT cursor id for a specific control or should i let the user to freely start/stop multiple threads in order? 回答1: Many people do not understand how "wait" cursors

ScheduledExecutorService and ThreadPoolTaskExecutor that interrupts tasks after a timeout

元气小坏坏 提交于 2020-01-17 03:44:14
问题 I Used ExecutorService that interrupts tasks after a timeout.I use a ScheduledExecutorService for this. First I submitted the thread and it once to begin immediately and retain the future that is created. After that i use ScheduledExecutorService as a new task that would cancel the retained future after some period of time. //Start Spring executor to submit tasks ThreadPoolTaskExecutor taskExecutor = (ThreadPoolTaskExecutor) ApplicationContextProvider.getApplicationContext().getBean(

optimizing bitmap loading by using aSyncTask

随声附和 提交于 2020-01-17 03:28:05
问题 I have been trying to optimize my single thread app which loads a bunch of tiles that makeup a large bitmap. The app was becoming very sluggish when it would load the new tiles into system memory. Im now looking trying to use Async Tasks for this purpose. The app detects which tile is in the top left in a method called by onDraw, creates a string that contains the path of the bitmap in the Assets folder, and then checks to see if the bitmap is null before drawing. If it is null, it will load

Need clarification on dispatch_group_wait() behavior when dispatch_group_create() and dispatch_group_enter() are called from different queues

风格不统一 提交于 2020-01-17 01:31:06
问题 I am looking at the Ray Wenderlich tutorial on using dispatch queues to get notified when a group of tasks complete. http://www.raywenderlich.com/63338/grand-central-dispatch-in-depth-part-2 The first code shown under "Code that works" is straight from the tutorial. The Alert view(final completion block) get executed after all 3 downloads complete. I tried to play around with it and moved the dispatch async down in the "Code that does not work" to see what will happen if dispatch_group_create