Questions tagged [thread-state]

Thread state describes state of thread in given time.

Thread can have one of states at the time.

States are implementation/platform dependent, but basically all of this states are implemented on most platforms:

  • NEW A Fresh thread that has not yet started to execute.

  • RUNNABLE A thread that is executing in the Java virtual machine.

  • BLOCKED A thread that is blocked waiting for a monitor lock.

  • WAITING A thread that is wating to be notified by another thread.

  • TIMED_WAITING A thread that is wating to be notified by another thread for a specific amount of time.

  • TERMINATED A thread whos run method has ended.

39 questions
3
votes
6 answers

How to tell if a thread has exited successfully?

According to the MSDN Documentation for ThreadState, the Stopped state can be entered by one of two ways: the thread exiting, or the thread being aborted. Is there some mechanism for telling whether a thread has entered the Stopped state by exiting…
Mark Carpenter
  • 17,445
  • 22
  • 96
  • 149
2
votes
1 answer

How to read System.Threading.Thread.ThreadState by Profiling API (ICofProfilerInfo or any IMetadataImport or any otherway)

Is there a way how to read the System.Thread.ThreadState property of a managed thread by Profiling API ICofProfilerInfo or IMetadataImport interface or any other way from unmanaged code? For example something like this: ICorProfilerInfo3…
honzajscz
  • 2,850
  • 1
  • 27
  • 29
2
votes
5 answers

Terminated Thread Revival

I am storing a bunch of threads objects in an arraylist. I want to be able to start these threads at random. Same thread can be started more than once. Before I start a thread object, I check on whether the thread is alive, and if they have either…
moejoe
  • 145
  • 2
  • 11
2
votes
4 answers

Java listen on Thread state

For debug purpose I would like to listen on a threads state. I want it to print a notification whenever the thread is waiting on a log and whenever it 'resumes'.
user2224350
  • 2,262
  • 5
  • 28
  • 54
2
votes
1 answer

Threads returning different values with static data

I am making a tool that runs on a large directory extracting data and starts a thread per language code (the first level of files in the directory). I added a loop that stops the threads from adding to the database until all threads are finished…
RebeccaD
  • 143
  • 5
  • 12
1
vote
1 answer

Check server operation status in C#. Check state of server process (business operation)

Client application initiates a process on a server (via RIA, but the implementationis not important). When I say process, I mean business code running and not referring to an actual process running on the CPU. Code is C#. The client then checks to…
user1060500
  • 1,505
  • 1
  • 21
  • 40
1
vote
1 answer

Will context-switching happen when thread changes its state?

In java, will context switching happen when thread is changing its state? I've googled a lot of sites, but did't find any article mentioned about this. so if anyone can help would be appreciated. like this: doSomething(); //when Thread.sleep() is…
1
vote
1 answer

How to Restore Thread from Blocked to Runnable State?

Context: I am writing a small Java program to troll my friends. This program, when run, spams the screen with many small windows in order to block the view and lag the machine. In an attempt to increase the rate at which windows appear, I've tried…
1
vote
3 answers

getting a thread state in c++/windows

There must be a function that gets the current status of a thread in the system because there is this application: http://www.softwareverify.com/cpp/thread-status-monitor/index.html It must be using some sort of API function or something... How…
Idov
  • 5,006
  • 17
  • 69
  • 106
1
vote
1 answer

How do I get the current state of a thread (e.g. blocking, suspended, running, etc..) in win32?

I couldn't find a documented API that yields this information. A friend suggested I use NtQuerySystemInformation. After looking it up, the information is there (see SYSTEM_THREAD ) but it is undocumented, and not very elegant - I get the information…
None
1
vote
0 answers

java monitor objects: threads BLOCK on some

While desperately trying out anything to unravel my load test glitches I came across TDA, a thread dump analysis tool for Java. Somehow I don't feel I am following its output. For instance, shouldn't there have been one thread in state RUNNABLE in…
kellogs
  • 2,837
  • 3
  • 38
  • 51
1
vote
1 answer

Windows thread-switching latency after IO completion - microseconds or milliseconds

I am trying to determine approximate time delay (Win 7, Vista, XP) to switch threads when an IO operation completes. What I (think I) know is that: a) Thread contex switches are themselves computationally very fast. (By very fast, I mean…
1
vote
2 answers

Threads staying alive after execution

I have created a ThreadManager class that handles Threads and its task is to add new threads and clean up the dead threads. However, the threads that are created remain alive and in ThreadState.WaitSleepJoin state. I have checked that the body has…
iCantSeeSharp
  • 3,880
  • 4
  • 42
  • 65
0
votes
3 answers

what does this thread state function do?

The following code strips a ThreadState to one of the four most useful values: Unstarted, Running,WaitSleepJoin, and Stopped: public static ThreadState SimpleThreadState (ThreadState ts) { return ts & (ThreadState.Unstarted | …
spspli
  • 3,128
  • 11
  • 48
  • 75
0
votes
1 answer

What Does the WAIT_BLOCKED Thread State Mean?

I was analyzing lttng trace for AudioTrack thread, so at the time of glitch it shows thread state as WAIT_BLOCKED. Can anyone please tell what is the meaning of thread state WAIT_BLOCKED. Here is the screenshot
Ameer ali khan
  • 965
  • 7
  • 10