Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Curses functions

Status
Not open for further replies.

rdakshin

Programmer
Oct 3, 2002
2
IN
Hello Every body,
We are using unix curses function for screen development.
One of our program calls "refresh()" function.
After the call to refresh(), the screen hangs displaying massage passed "RECEIVING IN PROGRESS" and slowly CPU usage increses and bocomes 95% for the process. The message does not disappear eventhough refresh() function is called.
We were to kill the process and rerun the process. Then it went fine. This is happening at times, approximately once in six months.

The main area of code is copied under:

Code:
..
..
#include <curses.h
..
..
..

void receive(RCV *qrcv, int tag_print_cnt, BOOL spw_flag, const char condition_code)
{
	// 

//	some declaration goes here
	// 
	//	some initialization goes here

	// 	some logic goes here

	
	i = 0;

  	while (i LT num_tags)  /*----THE BIG LOOP----*/
    	{
		
		// 	some initialization goes here

		clrerrl();    // definition is given below
    		prntmsg(&quot;RECEIVING IN PROGRESS....&quot;);    // definition is given below
   		 refresh();  // One more call to refresh()

		if(Bool)
		{
			// some logic goes here

			}

		do
		{

			
		}while(some condition)


		if(Bool)
		{
			//	some logic goes here

			}

	} // end of while

} // end of function


clrerrl () function definition:

void clrerrl()
  {
  	move(ERROR_LINE, 0);
  	clrtoeol();
  	refresh();
  }


prntmsg(&quot;String”) function definition:

void prntmsg(const char *message)
{
 	 int y, x;

  	getyx(stdscr, y, x);
  	move(ERROR_LINE, 0);
  	clrtoeol();
  	beep();
  	addstr((char *)message);
  	move(y, x);
  	refresh();
 }


We are 100% sure that there is no problem with the other part of the logic. This application is running for the past ten years. This application is developed in Unix/C and running in DEC Alpha.





Please help us in solving this occassionally happening problem.



Thanks a lot,
Dakshin
 
Sorry: more information required

1) Are you using Rogue Wave?

2) Is there a Terminal escape definition for your particular type of terminal. If it doesn't exist, it defaults to something weird.

3) Are you using xterms, dtterms or console emulation on a PC?
 
Hi,
Thanks a lot for your immediate response.
Following are the information you asked.

1) Are you using Rogue Wave?
We are not using Rogue Wave

2) Is there a Terminal escape definition for your particular type of terminal. If it doesn't exist, it defaults to something weird.
I am not very clear with this &quot;Terminal escape definition&quot;. I ran command &quot;stty -a&quot; and seen the settings.
In /usr/lib/terminfo, I seen many sundirectories related to terminfo.
Please educate more on this.

3) Are you using xterms, dtterms or console emulation on a PC?
We are using console emulation.

Please feel free to ask in case if you need more info.

Thank you,
Dakshin



 
By terminal escape definition, I meant things like esc [2J to clear the screen on an ANSI-xterm. Curses picks these up from terminfo. There are some strange problems if say the terminal says it is a VT220 and there is only the sequence for a VT320. In that case, you will get some strange message on startup (which may have been redirected to /dev/null) and everything appears to work normally but all of a sudden everything goes wonky. Happens with vi.

I've seen the message and the same effect before on our test programs. We normally just restart the program. That is OK for test programs but not so good for applications.

At a guess, curses is asking the terminal emulation for something and it is not responding or it only received a bit of the reply. It might be worth checking all the terminfo stuff for the terminal emulation: especially the response messages that the terminal emulation sends back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top