We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › multithreading possible
Page Index Toggle Pages: 1
multithreading possible? (Read 911 times)
multithreading possible?
Dec 4th, 2007, 12:20pm
 
Is multithreading with processing possible?

I wrote an applic that scans pictures. If the applic finds, for example, the color red. The applic will upload this picture via FTP to a server.

When the applic upload the pic, the scan stops because the applic do the upload.

Has someone an idea how I can upload and scan at the same time?


Thanks in advance!

- sorry for my english
Re: multithreading possible?
Reply #1 - Dec 4th, 2007, 2:23pm
 
Yes, you can do it with Java Threads.

Code:
import java.lang.Thread;

class UploadThread extends Thread {
public void run() {
// put your upload code here
}
}


In your scan loop, just start a new thread with the following code (it will not wait until the upload is done to continue scanning) :

Code:
UploadThread upload = new UploadThread();
upload.start();
Re: multithreading possible?
Reply #2 - Dec 4th, 2007, 2:45pm
 
Nice!! Thank you!

i'll try it out at home
Re: multithreading possible?
Reply #3 - Jan 6th, 2008, 8:51am
 
Hi, did it work?
i would like to know how you do the upload download via ftp. do you use the sftp library?
im not sure- it does not seem to work with normal ftp servers.
greets and danke^^ ramin
Page Index Toggle Pages: 1