Search Results

Search found 8588 results on 344 pages for 'thread abort'.

Page 39/344 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • WPF -- Event Threading, GUI updating question

    - by LSTayon
    I'm trying to send two events to the main window so that I can show some kind of animation that will let the user know that I'm updating the data. This is an ObservableCollection object so the OnPropertyChanged is immediately picked up by the bindings on the main window. The sleep is only in there so that the user can see the animation. However, the first OnPropetyChanged is never seen. I'm assuming this is because we're in a single thread here and the timer_Tick has to finish before the GUI updates. Any suggetions? In VB6 land we would use a DoEvents or a Form.Refresh. Thanks! private void timer_Tick(object sender, EventArgs e) { Loading = "Before: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); LoadData(); Thread.Sleep(1000); //Loading = Visibility.Hidden; Loading = "After: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); }

    Read the article

  • Timer or Thread?

    - by Pradeep Singh
    I have a method(say method1) that writes to database(sqlserver)and another method(say method2) that tries to access the same database after some time and updates the data row that was created by method1. The problem arises when method1 fails to access db due to the LAN being disconnected (this is not an exception this is a scenario that will definitely arise in my software, getting into details will make the question too complex) if method1 fails to access db method2 cannot work. What I want to do is to make method1 store values to local db instead of server if the LAN is disconnected and as soon as it enters value in local db the application should start trying to access the server after ever 10-15 seconds. What should I use timer or create a new thread?

    Read the article

  • Thread and two dimensional array in objective C?

    - by mactonny
    Hey, guys, I am just starting to wrap my head around objective C and I am doing a little project on Iphone. And I just encountered a weird problem. I had to deal with images in my program so I have a lot local variables declared like temp[width][height]. If I am not using NSThread to perform image processing, it works all fine. However, if I use NSThread, it'll keep giving me EXC_BAD_ACCESS on whenever I try to access a 2-D array declared like temp[widht][height]. So I have to allocate memory from heap in order to have a 2-D array. That'll solve the problem but I still don't get it. My first thought would be stack over flow, but it worked all fine with one thread. I just don't get it.

    Read the article

  • How do I let main thread wait for the Timer.timer

    - by Kelvin
    Hi I am using System.Timer.Timer I always get NULL after running my programme and it only works if I add this.sleep(6000). Suppose the reason is the main thread ends but the timer hasn't finished ... Here is the class and I call the class from my main form. Class class1 { string finalResult = ""; public string getNumber() { RunTimer(); return finalResult; } pubic void RunTimer () { timer = new System.Timers.Timer(6000); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(cal); timer.Start(); } private void cal(object sender,System.Timers.ElapsedEventArgs e) { finalResult = READFROMCOMPORT; } }

    Read the article

  • process thread scheduling

    - by arvind
    I have the following query regarding the scheduling of process threads. a) If my process A has 3 threads then can these threads be scheduled concurrently on the different CPUs in SMP m/c or they will be given time slice on the same cpu. b) Suppose I have two processes A with 3 threads and Process B with 2 threads (all threads are of same priority) then cpu time allocated to each thread (time slice) is dependent on the number of threads in the process or not? Correct me if I am wrong is it so that cpu time is allocated to process which is then shared among its threads i.e. time slice given to process A threads is less than that of Process B threads.

    Read the article

  • How do I run different threads in Java?

    - by Cris Carter
    Hey. I'm having some problems with threads. I understand how they work, but since they all use the same method, how do I run different threads that do completely different things, but at the same time? To me, it seems that they always use the same standard method which makes them do the same thing. So, let's say I have a big .txt file where I want to go through each line and do something to the line. In this case, I would like to have each thread do 1/10th of the .txt file, but I don't understand how the threads can communicate with each other, and how they could organize so each thread does the right part? Could anyone explain or help me with this? Would be very much appreciated!

    Read the article

  • iphone - memory leaks in separate thread

    - by Brodie4598
    I create a second thread to call a method that downloads several images using: [NSThread detachNewThreadSelector:@selector(downloadImages) toTarget:self withObject:nil]; It works fine but I get a long list of leaks in the log similar to: 2010-04-18 00:48:12.287 FS Companion[11074:650f] * _NSAutoreleaseNoPool(): Object 0xbec2640 of class NSCFString autoreleased with no pool in place - just leaking Stack: (0xa58af 0xdb452 0x5e973 0x5e770 0x11d029 0x517fa 0x51708 0x85f2 0x3047d 0x30004 0x99481fbd 0x99481e42) 2010-04-18 00:48:12.288 FS Companion[11074:650f] * _NSAutoreleaseNoPool(): Object 0xbe01510 of class NSCFString autoreleased with no pool in place - just leaking Stack: (0xa58af 0xdb452 0x5e7a6 0x11d029 0x517fa 0x51708 0x85f2 0x3047d 0x30004 0x99481fbd 0x99481e42) 2010-04-18 00:48:12.289 FS Companion[11074:650f] * _NSAutoreleaseNoPool(): Object 0xbde6720 of class NSCFString autoreleased with no pool in place - just leaking Stack: (0xa58af 0xdb452 0x5ea73 0x5e7c2 0x11d029 0x517fa 0x51708 0x85f2 0x3047d 0x30004 0x99481fbd 0x99481e42) Can someone help me understand the problem?

    Read the article

  • Asp.Net : Web service throws "Thread was being aborted"

    - by Master Morality
    I have a web service that I call via ajax that requires the user to be logged in. in each method I want to check if the user is logged in and send a 403 code if they are not, however when I call a Response.End() I get the error "Thread was being aborted". What should I call instead? [WebMethod(true)] public string MyMethod() { if(!userIsLoggedIn) { HttpContext.Current.Response.StatusCode = 403; HttpContext.Current.Response.End(); } /* Do stuff that should not execute unless the user is logged in... */ ... }

    Read the article

  • Null object that is not null

    - by Guillaume
    Hello, I use 2 threads to act like a produce/consumer using double queue (http://www.codeproject.com/KB/threads/DoubleQueue.aspx). Sometimes in my 2nd thread, I get an object that is NULL but it should not be as I filled it in the first thread. I tried this: if(myObject.Data == null) { Console.WriteLine("Null Object") // <-- Breakpoint here } When I my break point hits, I can watch myObject.Data and indeed it's NULL, but when I hit F10 and then go to the next line (which is } ) myObject.Data is not NULL. I also added a lock on myObject before if .... to be sure that no one whould use this object. How is that possible and what can I do ?

    Read the article

  • Java Swing GUI exception - Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException:

    - by rgksugan
    I get this exception when i run my application. I dont have any idea what is going wrong here. Can someone help please. Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException: Vector Enumeration at java.util.Vector$1.nextElement(Vector.java:305) at javax.swing.plaf.basic.BasicTableHeaderUI.getPreferredSize(BasicTableHeaderUI.java:778) at javax.swing.JComponent.getPreferredSize(JComponent.java:1634) at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:78) at java.awt.Container.preferredSize(Container.java:1599) at java.awt.Container.getPreferredSize(Container.java:1584) at javax.swing.JComponent.getPreferredSize(JComponent.java:1636) at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:702) at java.awt.Container.layout(Container.java:1421) at java.awt.Container.doLayout(Container.java:1410) at java.awt.Container.validateTree(Container.java:1507) at java.awt.Container.validate(Container.java:1480) at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:669) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Read the article

  • I am getting exception in main thread...even when i am handling the exception

    - by fari
    public KalaGame(KeyBoardPlayer player1,KeyBoardPlayer player2) { //super(0); int key=0; try { do{ System.out.println("Enter the number of stones to play with: "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); key = Integer.parseInt(br.readLine()); if(key<0 || key>10) throw new InvalidStartingStonesException(key); } while(key<0 || key>10); player1=new KeyBoardPlayer(); player2 = new KeyBoardPlayer(); this.player1=player1; this.player2=player2; state=new KalaGameState(key); } catch(IOException e) { System.out.println(e); } } when i enter an invalid number of stones i get this error Exception in thread "main" InvalidStartingStonesException: The number of starting stones must be greater than 0 and less than or equal to 10 (attempted 22) why isn't the exception handled by the throw i defined at KalaGame.<init>(KalaGame.java:27) at PlayKala.main(PlayKala.java:10)

    Read the article

  • How to spin an independent dispacher thread for a Silverlight UserControl

    - by ondesertverge
    I am trying to move a lot of different elements by 1 pixel very often and in parallel. Trying to do this on one dispatcher thread means that the elements are visited one after another. The result is that the more elements I have the slower they will all move. In WPF I was able to use a HostVisual as described here to solve this. I can't seem to find anything similar in Silverlight. Is this a drawback of the lightweight framework or is there something I haven't stumbled upon yet? I am using SL4.

    Read the article

  • [java] Efficiency of while(true) ServerSocket Listen

    - by Submerged
    I am wondering if a typical while(true) ServerSocket listen loop takes an entire core to wait and accept a client connection (Even when implementing runnable and using Thread .start()) I am implementing a type of distributed computing cluster and each computer needs every core it has for computation. A Master node needs to communicate with these computers (invoking static methods that modify the algorithm's functioning). The reason I need to use sockets is due to the cross platform / cross language capabilities. In some cases, PHP will be invoking these java static methods. I used a java profiler (YourKit) and I can see my running ServerSocket listen thread and it never sleeps and it's always running. Is there a better approach to do what I want? Or, will the performance hit be negligible? Please, feel free to offer any suggestion if you can think of a better way (I've tried RMI, but it isn't supported cross-language. Thanks everyone

    Read the article

  • Occasional InterruptedException when quitting a Swing application

    - by Joonas Pulakka
    I recently updated my computer to a more powerful one, with a quad-core hyperthreading processor (i7), thus plenty of real concurrency available. Now I'm occasionally getting the following error when quitting (System.exit(0)) an application (with a Swing GUI) that I'm developing: Exception while removing reference: java.lang.InterruptedException java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134) at sun.java2d.Disposer.run(Disposer.java:125) at java.lang.Thread.run(Thread.java:619) Well, given that it started to happen with a more concurrency-capable hardware, and it has to do with threads, and it happens occasionally, it's obviously some kind of timing thing. But the problem is that the stack trace is so short. All I have is the listing above. It doesn't include my own code at all, so it's somewhat hard to guess where the bug is. Has anyone experienced something like this before? Any ideas how to start solving it?

    Read the article

  • deciding between subprocess, multiprocesser and thread in Python?

    - by user248237
    I'd like to parallelize my Python program so that it can make use of multiple processors on the machine that it runs on. My parallelization is very simple, in that all the parallel "threads" of the program are independent and write their output to separate files. I don't need the threads to exchange information but it is imperative that I know when the threads finish since some steps of my pipeline depend on their output. Portability is important, in that I'd like this to run on any Python version on Mac, Linux and Windows. Given these constraints, which is the most appropriate Python module for implementing this? I am tryign to decide between thread, subprocess and multiprocessing, which all seem to provide related functionality. Any thoughts on this? I'd like the simplest solution that's portable. Thanks.

    Read the article

  • Ruby socket server thread question: how to send to all clients?

    - by Paul
    I'm making a TCP socket server(ruby). A thread is created for each connected client. At some point I try to send data to all connected clients. The thread aborts on exception while trying.(ruby 1.8.7) require 'socket' # I test it home right now server = TCPServer.new('localhost', 12345); while(session = server.accept) #Here is the thread being created Thread.new(session) do |s| while(msg = s.gets) #Here is the part that causes the error Thread.list.each { |aThread| if aThread != Thread.current #So what I want it to do is to echo the message from one client to all others #But for some reason it doesn't, and aborts on the following string aThread.print "#{msg}\0" end } end end Thread.abort_on_exception = true end What am I doing wrong?

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError: while running .bat file

    - by Manu
    hi, i have bat file like below with name (myBat.bat) @echo off set CLASSPATH=%CLASSPATH%;C:\Documents and Settings\nchakk\Desktop\3611 java\ javac packbat.inter.java javac packbat.samplepack.java java packbat.inter java packbat.samplepack pause //interface "inter" inside package packbat package packbat; public interface inter { int i=10; } //my main()class inside package packbat package packbat; public class samplepack implements inter { public static void main(String s[]) { System.out.println(i); } } after clicking that .bat file it diplay error like below Exception in thread "main" java.lang.NoClassDefFoundError: packbat/inter Caused by: java.lang.ClassNotFoundException: packbat.inter how to run tat .bat file without error. Pls reply ASAP.Thanks in advance

    Read the article

  • Calling UIGetScreenImage() on manually-spawned thread prints "_NSAutoreleaseNoPool():" message to lo

    - by jtrim
    This is the body of the selector that is specified in NSThread +detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgument NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while (doIt) { if (doItForSure) { NSLog(@"checking"); doItForSure = NO; (void)gettimeofday(&start, NULL); /* do some stuff */ // the next line prints "_NSAutoreleaseNoPool():" message to the log CGImageRef screenImage = UIGetScreenImage(); /* do some other stuff */ (void)gettimeofday(&end, NULL); elapsed = ((double)(end.tv_sec) + (double)(end.tv_usec) / 1000000) - ((double)(start.tv_sec) + (double)(start.tv_usec) / 1000000); NSLog(@"Time elapsed: %e", elapsed); [pool drain]; } } [pool release]; Even with the autorelease pool present, I get this printed to the log when I call UIGetScreenImage(): 2010-05-03 11:39:04.588 ProjectName[763:5903] *** _NSAutoreleaseNoPool(): Object 0x15a2e0 of class NSCFNumber autoreleased with no pool in place - just leaking Has anyone else seen this with UIGetScreenImage() on a separate thread?

    Read the article

  • Efficiency of while(true) ServerSocket Listen

    - by Submerged
    I am wondering if a typical while(true) ServerSocket listen loop takes an entire core to wait and accept a client connection (Even when implementing runnable and using Thread .start()) I am implementing a type of distributed computing cluster and each computer needs every core it has for computation. A Master node needs to communicate with these computers (invoking static methods that modify the algorithm's functioning). The reason I need to use sockets is due to the cross platform / cross language capabilities. In some cases, PHP will be invoking these java static methods. I used a java profiler (YourKit) and I can see my running ServerSocket listen thread and it never sleeps and it's always running. Is there a better approach to do what I want? Or, will the performance hit be negligible? Please, feel free to offer any suggestion if you can think of a better way (I've tried RMI, but it isn't supported cross-language. Thanks everyone

    Read the article

  • DataGridView bound to a Dictionary and updated with a thread

    - by Manjoor
    I have a Dictionary binded to DataGridView by using following sample code. http://stackoverflow.com/questions/854953/datagridview-bound-to-a-dictionary Please see the above question first The diffrence is that i am updating dictionary from a thread. (Event handler of another class). My Event handler is as below static void f_PriceChanged(Objet f, eventData e) { if (prices.ContainsKey(e.ItemText)) prices[e.ItemText] = e.price; else prices.Add(e.ItemText, e.price); } Not to mention the prices is declared as class level. I have modified the button code from original post as Button btn = new Button(); btn.Dock = DockStyle.Bottom; btn.Click += delegate { bl.Reset(); }; form.Controls.Add(btn); Internally the Dictionary is updated as expected but grid does not update. Clicking on button generate exception Collection was modified; enumeration operation may not execute What to do?

    Read the article

  • Thread-safe queue in Javascript or jQuery

    - by at
    I have many asynchronous AJAX calls whose results will get processed. It doesn't matter what order the processing occurs, but the results need to get processed one at a time. So I'd like to simple do my AJAX calls and they all just put their results in a single queue. That queue should then get processed on a single thread. This way the results get processed one at a time as soon as possible. What's the best way to do this? I'm using jQuery, so happy to take advantage of any facilities it provides for this.

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError

    - by Manu
    package pack; public class sample{ public static void main(String input[]) { NumberFormat numberFormat = new DecimalFormat("#,##0.00##"); System.out.println(numberFormat.format(44533125.00)); } } the code is working fine in the current dir.. (c:/myprogram/). after that i copy the sample.class file and paste it in other dir(d:/myprogram). i got error while running, like " Exception in thread "main" java.lang.NoClassDefFoundError: sample (wrong name: pack/sample)" In java .class file can run anywhere right? but why i am not able to run?

    Read the article

  • Is it possible to use AsyncTask in a Service class ?

    - by Spredzy
    Everything is in the title. On the official documentations it is stated that Note that services, like other application objects, run in the main thread of their hosting process and AsyncTask only works if it is executed in the UIThread. So is it possible to use AsyncTask in a Service class? I am trying to do so but I'm always getting the same error 05-01 18:09:25.487: ERROR/JavaBinder(270): java.lang.ExceptionInInitializerError ... 05-01 18:09:25.487: ERROR/JavaBinder(270): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() Am I doing something wrong or is this just impossible ?

    Read the article

  • How do I let main thread suspend and wait for the System.Timer.Timer running

    - by Kelvin
    Hi I am using System.Timer.Timer I always get NULL after running my programme and it only works if I add this.sleep(6000). Suppose the reason is the main thread ends but the timer hasn't finished ... Here is the class and I call the class from my main form. Class class1 { string finalResult = ""; public string getNumber() { RunTimer(); return finalResult; } pubic void RunTimer () { timer = new System.Timers.Timer(30000); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(cal); timer.Start(); } private void cal(object sender,System.Timers.ElapsedEventArgs e) { finalResult += READFROMCOMPORT; } }

    Read the article

  • WPF update binding in a background thread

    - by Mark
    I have a control that has its data bound to a standard ObservableCollection, and I have a background task that calls a service to get more data. I want to, then, update my backing data behind my control, while displaying a "please wait" dialog, but when I add the new items to the collection, the UI thread locks up while it re-binds and updates my controls. Can I get around this so that my animations and stuff keep running on my "please wait" dialog? Or at least give the "appearance" to the user that its not locked up?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >