Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6541445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:06:22+00:00 2026-05-25T11:06:22+00:00

I started a new thread to upload photos from the phone mobile to a

  • 0

I started a new thread to upload photos from the phone mobile to a computer webserver.

if (CMenu.retCommand == transferer)
{
     thrdTrsfr = new Thread(this);
     thrdTrsfr.start();
}

public void run() {
        if (Thread.currentThread() == thrdTrsfr)
        {
            if (vButtonPhotos.size() > 0)
                transfererPhotos("http://192.168.1.123/imfmobile/photoj2meupload/uploadphoto.php");
            else
                afficheAlert("Aucune photo à transférer !");
        }
    }

When the upload is finished then I stopped the thread. I tested the number of active threads before the upload. When I tested the number of running threads after stopping the upload thread, the number does not change. I must navigate back to the main screen then the number of active thread is the same at before the upload. I use this code to stop the upload thread :

if (thrdTrsfr != null && thrdTrsfr.isAlive())
{
    thrdTrsfr.interrupt();
    thrdTrsfr = null;
}

So why must I go to the main screen in order to get the thread stopped?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:06:23+00:00Added an answer on May 25, 2026 at 11:06 am

    Could it be that transfererPhotos() is not finishing, perhaps due to waiting for an IO read of bytes that never arrives? If so, then the thread will stay alive forever, or until interrupted (as you are doing).

    BTW, I can’t see any value to the test for current thread:

    if (Thread.currentThread() == thrdTrsfr) // Huh?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C++ , during a class constructor, I started a new thread with this
I just started a new Typo3 4.6 site and I found this weird line
Let's say I have started new thread with pthread_create() and then detached it using
I've just started with C#. I'm running an object's function as a thread (new
I've seen this code lately: static List<Thread> list = new List<Thread>(); static void Main(string[]
Quick question: Is it possible to showDialog/Show form from a new thread that has
I have the following code: var x = new Thread(new ThreadStart(Delegate)); x.Start(); This will
I recently started this question in another thread (to which Reed Copsey graciously responded)
I've started work on a simple newtworking project which creates a new thread for
I started a new job recently. I've been a Java & XML web developer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.