LittleZZ Veteran 442 Posts user info edit post |
I am working on a program and part of it involves writing a .img file to a floppy. Currently I am implementing this by a Runtime Process that executes dd in Linux. This works fine except that I want to notify the user when the process is finished and if there were any errors. All of this wouldn't be a problem if i could simply use Process.waidfor(), but I am running it from a SWT GUI, and when the waitfor() is called, it interupts the GUI refresh and all of the widgits disapear. When the process is done, they come back, but I'm trying to get it where it doesn't look like there are any problems and the widgets stay on the screen.
I have tried running the process in a new thread, seperate from my GUI, and that works, but if I don't synchronize the threads, there is a delay (about a minute) between when the disk write is finished, and when the user feed back is displayed on the screen. This brings about another problem in that if I synchronize the threads, I have to make the GUI thread wait for the notification from the disk write thread, and this creates the same issue as using .waitfor().
So, I'm wondering if anyone can help by knowing:
1) if there is another way to see if a process is finished executing besides using waitfor(). If i can set up a loop I can run the refresh code and it shouldn't be a problem.
or
2) if there is a Java API for writing an image to a disk so I don't have to use dd and a separate process. This would probably be best (and would allow me to write the images to disk without rawwrite in windows), although my knowledge of what to do to get it all working would be in the area of retarded.
Thanks 1/24/2006 3:33:24 PM |
LittleZZ Veteran 442 Posts user info edit post |
thanks Shaggy...I've actually gotten it working.
With SWT you have to use Display.asyncExec() to run a thread without fucking everything up. I could have sworn I had tried it before and it didn't work, but for some reason it worked after I posted. I guess its one of those, as soon as you try to show someone else it starts working kinds of things. That said, if you could double check what you've done in the past that would be helpful so I can do the same thing with Windows and Linux. Right now I have to run rawwrite sepparately for Windows, and I'd like to be able to control everything from one program as it is supposed to be an all inclusive application for some stuff here at work. Thanks again for your help 1/24/2006 6:13:05 PM |