# Thread

**URL:** <https://www.ruby-forum.com/t/thread/108426>\
**Category:** Ruby\
**Created:** [July 3, 2007, 12:47pm UTC](https://www.ruby-forum.com/t/thread/108426 "2007-07-03T12:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 3, 2007, 12:47pm UTC](https://www.ruby-forum.com/t/thread/108426/1 "2007-07-03T12:47:33Z")

</div>

Hi,  
My code looks similar to following:

* * *

def someFunction()  
#do telnet connection  
#execute binary file which throws on std its output endlessly  
end

tr = Thread.new() { someFunction() }

while true

# 

# sth to done …

# 

# and show tr status

## puts “Status tr: #{tr.status}” end

someFunction executes telnet command which executes an application which  
throws debug messages on output - this output is continually writes to a  
file. Summary: telnet command never ends ( I hope so ).  
In main thread in each iteration of while loop I’ve tried to puts tr  
status but each time it notifies that tr.status =\> sleep

Can anybody explain me what is wrong or explain me what Thread#status  
statuses means?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 3, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/thread/108426/2 "2007-07-03T13:02:20Z")

</div>

> someFunction executes telnet command which executes an application which  
> throws debug messages on output - this output is continually writes to a  
> file. Summary: telnet command never ends ( I hope so ).  
> In main thread in each iteration of while loop I’ve tried to puts tr  
> status but each time it notifies that tr.status =\> sleep
> 
> Can anybody explain me what is wrong or explain me what Thread#status  
> statuses means?

It should be that the someFunction its waiting for I/O… take a look at

[http://corelib.rubyonrails.org/classes/Thread.html#M001144](http://corelib.rubyonrails.org/classes/Thread.html#M001144)

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 3, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/thread/108426/3 "2007-07-03T13:05:57Z")

</div>

2007/7/3, Marcin T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> someFunction executes telnet command which executes an application which  
> throws debug messages on output - this output is continually writes to a  
> file. Summary: telnet command never ends ( I hope so ).  
> In main thread in each iteration of while loop I’ve tried to puts tr  
> status but each time it notifies that tr.status =\> sleep
> 
> Can anybody explain me what is wrong or explain me what Thread#status  
> statuses means?

It probably just means that the thread is waiting for IO from the  
child process. To give more detailed answers you probably should  
disclose a bit more detail.

Kind regards

robert
