How to sleep/pause the current thread in multiple thread
The Sleep thread method will sleep the current thread only or all the thread
// <summary> /// To Upload image from the thread /// </summary> private static void Do_Error_work() {
while (!_shouldStop)//Todo:make it alterway {
if (!check_Internetconnection) { if (Error_Status == null) { if (Convert.ToInt32(no_fail_photos) <= Max_no_photos)//Get Maximum no of photos. { upload_photo(Properties.QTLibSettings.Default.Folder_path, Error_Album_Id);///Function call the upload photos. } } } else { Thread.Sleep(Time); //wait for 5 min } }
} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Do_Pass_work /// </summary> private static void Do_Pass_work() {
if (!check_Internetconnection) { if (Error_Status == null) { if ( Convert.ToInt32(no_pass_photos) <= Max_no_photos)//Check for Maximum of Photos; { upload_photo(Properties.QTLibSettings.Default.Folder_pass, Pass_Album_Id);///Function call the upload photos. } } } else //Internet connection failed { if (!Initialize()) { Thread.Sleep(Time); //Wait for 5 min }
}