AsynchronousLoad and AsynchronousLoad problem
Hi all:
i want to implement two methods :asynchronousLoad() andsynchronousLoad(),but i don't understand asynchronous and synchronous clearly.
Q1:
when i implement them, whether i need to create thread on both of them, or i olny need create thread on one of them?
Q2: the keywordsynchronized need? if yes,how to use it?
thanks
MIle
[412 byte] By [
MIlea] at [2007-10-2 6:27:14]

> Hi all:
>
> i want to implement two methods
> :asynchronousLoad() and
> synchronousLoad(),but i don't understand
> asynchronous and synchronous clearly.
> Q1:
> when i implement them, whether i need to create
> thread on both of them, or i olny need create thread
> on one of them?
> Q2: the keyword synchronized need? if
> yes,how to use it?
>
> thanks
> MIle
Don't confuse synchronous with synchronise.
For your synchronous design you need not use a new thread if the application will be waiting for the method to complete. If you want the UI to function during the method then you might use a new thread but this is a different issue really.
For your asynchronous method you will need a new thread. If the method shares any resource which might be used by the main thread you may need to use synchronise somewhere but this is not necessarily required.
Hi,i hvae new problem now! if the two method both can be aborted by another thread,what should i do? whether they both need threads?if so,what 's the difference between the two threads?ThanksMile
MIlea at 2007-7-16 13:29:06 >
