Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 10:48 am   

Quick question on Threads
 
How many Threads should be running when you open Cmud?

When I open Cmud and type #THREAD on command line it shows 6 threads running. Nothing happening in the debugger either. No scripts are running.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Jan 10, 2009 11:15 am   
 
There should be only one thread running by default - for your command line. If you have other windows with cmdline, they may span their own threads, but only after you have typed something in their command lines.

Do you have some threading stuff in your onLoad event handler?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Jan 10, 2009 11:18 am   
 
You mean just on the untitled session? There should just be one, and that's just the session's command line running because you entered a command. What output do you get from #thread, exactly?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 11:23 am   
 
No this is my session. If I open my session offline, and then type #THREAD I get this:

Code:
Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  6              [u] Achaea           running             


It should be #1 not 6 right? Why did 6 threads run? Nothing happens but default variables resetting.

Also I don't have an onLoad event.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Jan 10, 2009 11:27 am   
 
It means "thread with ID=6 is running", not 6 threads are running.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 11:34 am   
 
Haha ok. So why is it #6 and not #1 like in an untitled session?

Like if I open other sessions offline it shows:

Code:

Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  1              [u] Aetolia          running             


6 is not ID it is the number right?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Jan 10, 2009 11:47 am   
 
Well, the number is just an internal, numerical ID - the ID is a string ID that you give it. But yeah, it does start numbering from 1, so it's strange that the command-line's been given #6. But it's probably nothing to worry about.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 11:49 am   
 
Ok another example...I typed #THREAD named {#wait 5000;#say yes} on command line then typed #THREAD while it was waiting and then after it ran and got:

Code:
Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  1              [u] Aetolia          running             
  3   named      Aetolia              wait 3281 ms         Compiled #THREAD command
yes
Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  1              [u] Aetolia          running             


That thread was #3, but my main thread is always #1. Why does my other session start at 6?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Jan 10, 2009 11:50 am   
 
I think while your session is loading it calls several #WAIT or other threading commands like #ALARM with their own thread. When these threads come to the end, the new tread for your main Achaea window gets next unused ID. In your case it is ID=6

If your session doesn't run any threading commands while loading, then there may be (or may not) some problems. My personal opinion (although Zugg is saying that it is OK) is that fast incrementing ID value for the GUI thread is a sign of the threading problem.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 11:55 am   
 
Well thats what I am saying. When I load CMUD and that session nothing runs. The only thing happening is that defaults on the variables set to 1 or 0 or whatever right? I don't have onload or any #wait or #alarm or threading or anything going on, but it always shows #6.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Jan 10, 2009 12:09 pm   
 
In this case I think it is OK. I have main thread ID=3 in my own session although I have no threading stuff in my onLoad event handler, single thread scripting only.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 12:12 pm   
 
Okay I disabled the class folder with my toolbar and buttons. Now it always shows #3 when I open it offline.

Code:
Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  3              [u] Achaea           running             
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 12:17 pm   
 
Ah you show #3 too? Well it is confusing that my main thread is not #1 but okay.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jan 10, 2009 12:29 pm   
 
Okay I discovered the cause. It is expression triggers and buttons. I disabled the class containing the expression triggers and the class containing the buttons and then reopened Cmud and the session offline and got the following:

Code:
Threads:
  #   ID         Window Name          Status               Script
  -------------------------------------------------------------------------------------------------
  1              [u] Achaea           running             
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Jan 10, 2009 1:07 pm   
 
Cool. I tried to disable buttons in my package but there was no difference.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Jan 10, 2009 1:13 pm   
 
Told you it was nothing to worry about :P
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net