Hi David<br>When i am working on new server systemthen i encounter a serious problen in my program that<br> 
whenever i run server then either core of my cpu 
core have 100% usage.<br>
 I know this is happening because there is a infinite loop in a thread.<br>
<br>
void * main_thread(void * data)<br>
{<br>
    int flag=1,choice,n;<br>
    int temp;<br>
    TCPsocket client_socket,server_socket;<br>
    if(!child_intialize_thread())<br>
    {<br>
        printf(&quot;\n There is some error while initializing thread&quot;);<br>
        return 0;<br>
     }<br>
    printf(&quot;\n Value of active ports is:%d&quot;,child_active_ports);<br>
<br>
    // first server receive request from client to connect and open master server socket. To be created only once.-permanent <br>
    if(common_connect_server(&amp;host_ipaddress,&amp;server_socket,2000,(const char *)NULL)==0)<br>
        return (void *)1;<br>
    while(quit) <br>
    
{                                                                                                                                                   
 //from here main problem starts i have to keep it in while loop so that
 it can accept <br>
        if((client_socket=SDLNet_TCP_Accept(server_socket)))<br>
        
{                                                                                                                                               
 // connect to different clients so that it can work as concurrent 
server. Is there any way <br>
            
pthread_mutex_lock(&amp;child_mutex_variable);                                                                           
 // is there any other way to do it and avoid high cpu usage. <br>
            printf(&quot;\n Value of active ports:%d&quot;,child_active_ports);<br>
            if(child_active_ports==0)<br>
            {<br>
                int temp=0;<br>
                SDLNet_TCP_Send(client_socket,&amp;(temp),2);<br>
                SDLNet_TCP_Close(client_socket);<br>
                pthread_mutex_unlock(&amp;child_mutex_variable);<br>
            }<br>
            else<br>
            {<br>
                pthread_mutex_unlock(&amp;child_mutex_variable);<br>
                printf(&quot;\n Activating thread&quot;);<br>
                activate_thread(client_socket);<br>
            }    <br>
        }<br>
    }<br>
        printf(&quot;\nEverything is OK now exiting&quot;);    <br>
        SDLNet_TCP_Close(server_socket);<br>
        cleanup_thread();<br>
        return NULL;<br>
}<br>