state Stateinfo = (state) asyncresult.asyncstate;
int workerthreads;
int portthreads;
Try
{
Threadpool.getavailablethreads (out WorkerThreads,
Out portthreads);
StateInfo.fStream.EndWrite (asyncresult);
Thread.Sleep (1500);
}
Finally
{
StateInfo.autoEvent.Set ();
}
}
Comparison of two ways:
Mode one: Suitable for large database load, binary data size known;
Mode two: Suitable for the database load is small, binary data size is unknown;
Among them: The asynchronous mechanism of the two methods are the same, without any difference; The advantage of asynchronous mechanism is that it can give full play to the advantages of operating system
Note: Asynchronous mechanisms cannot be used in contexts where performance testing is required, and synchronization mechanisms must be used to improve authenticity
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.