TThreads and TMonitor::Select

Sorry for this big delay. Now I have tried a little bit different way, but still I have a problem:
1/ I have started with the example from tutorials and created some ‘server’ code. I run it from CINT and it works a similar way as ‘nc’ (tested with nc client), no visible problem.
2/ I have plugged this part into some testing TThread frame, and here it is (as simplified as I could):

#include <stdio.h>
#include "TSocket.h"   //net thread
#include "TServerSocket.h"
#include "TMonitor.h"
#include "TThread.h"   // CINT? //  -lThread

#include <iostream>
#include <fstream>    
using namespace std;

const int MAXTHREADS=10;

//---------------------------------this part works quite fine when run from CINT alone--
void net_server( void *arg )  
{
    int port=9999;
  while( 1==1 ){
    printf("%s\n" ,"entered main while loop in net_server");
   TServerSocket *ss = new TServerSocket(port, kTRUE);
   TMonitor *mon = new TMonitor;
   mon->Add(ss);
   TSocket *s0 = 0, *s1 = 0, *s2 = 0;
   int wait=1; //EXTRA
   while (1) {
      TSocket  *s;
     do{ s = mon->Select( 1000 ); printf("%s",".\n" );}while(  (int)s==-1 );

      if (s->IsA() == TServerSocket::Class()) {
         if (!s0) {
           s0 = ((TServerSocket *)s)->Accept();
            mon->Add(s0);
         } else if (!s1) {
	   printf("I am in s1 :%s\n","" );
            s1 = ((TServerSocket *)s)->Accept();
            mon->Add(s1);
         }  
        continue;
      }//if  IsA

      char aaa[1000]; int get;
       char newline='\n';
     get=s->RecvRaw( aaa , 1000, kDontBlock);
      printf("Client %d: get==%d:           <%s>\n", s==s0 ? 0 : 1, get, aaa );
     aaa[get]='\0';
      printf("Client %d: get==%d:           <%s>\n", s==s0 ? 0 : 1, get, aaa );

      if (get==0){
         mon->Remove(s);
	 s0=NULL; // one client is fine for me (i can do two), here I recycle the s0 socket
      }// get==0
      if (strstr(aaa,"kill")!=0){
         printf("in a kill : active==%d\n", mon->GetActive() );
	 mon->Remove(s);// this is removed. others not
         mon->Remove(ss); ss->Close();
         printf("in a  kill : active==%d\n", mon->GetActive() );
      }
      if (mon->GetActive() == 0) {
            printf("No more active clients... stopping\n");
            break;
      }
   }//while (1)
  } // BIG  WHILE 1==1

 printf("%s","net_server stop \n");
 return ;
}// .............................................................net_server end



// ------------------------------MAIN----------------------
void testbench(){

TThread *shspe_threads[MAXTHREADS];

    shspe_threads[1] = new TThread( "my_server" , net_server, NULL );
    if (shspe_threads[1]==NULL){ printf("exiting, thread 1 not running\n%s","");return ;}
    shspe_threads[1]->Run();

}// .....................................................................testbench

3/ I do
root -n
.L testbench.C+
testbench()
and … a result - even without sending data from outside (‘nc’) - it crashes in a short time when I play with enter in cint…
I have observed that do-while loop (that with ->Select, I fprint ‘.’ there) stops sometimes after enter, sometimes starts again. I see some TTermInputHandler:

======= Backtrace: ========= /lib/i686/cmov/libc.so.6(+0x6b381)[0xb65dc381] /lib/i686/cmov/libc.so.6(+0x6cbd8)[0xb65ddbd8] /lib/i686/cmov/libc.so.6(cfree+0x6d)[0xb65e0cbd] /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb67d1701] /usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0xb67ad6bd] /usr/lib/libstdc++.so.6(_ZNSs6assignERKSs+0xa0)[0xb67af1d0] /home//root/lib/root/libCore.so(_ZN9textinput9TextInput9TakeInputERSs+0x38)[0xb7289b98] /home//root/lib/root/libCore.so(Getlinem+0x50e)[0xb727d5ce] /home//root/lib/root/libRint.so(_ZN5TRint15HandleTermInputEv+0x46)[0xb683f7e6] /home//root/lib/root/libRint.so(_ZN17TTermInputHandler6NotifyEv+0x25)[0xb683df55] /home//root/lib/root/libRint.so(_ZN17TTermInputHandler10ReadNotifyEv+0x14)[0xb6840de4] /home//root/lib/root/libCore.so(_ZN11TUnixSystem16CheckDescriptorsEv+0x177)[0xb725d127] /home//root/lib/root/libCore.so(_ZN11TUnixSystem16DispatchOneEventEb+0xf8)[0xb725d2f8] /home//root/lib/root/libCore.so(_ZN7TSystem9InnerLoopEv+0x24)[0xb71c8474] /home//root/lib/root/libCore.so(_ZN7TSystem3RunEv+0x89)[0xb71cb369] /home//root/lib/root/libCore.so(_ZN12TApplication3RunEb+0x37)[0xb715a5a7] /home//root/lib/root/libRint.so(_ZN5TRint3RunEb+0x28d)[0xb684078d] /home//root/bin/root.exe(main+0x6f)[0x8048eaf] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb6587ca6] /home//root/bin/root.exe[0x8048d71]

Any idea? Please…
Best regards, jaromir