Hi All
I have written Following program so that fun() gets called by every 10 mili
seconds.But after executing the program I Found its calling the function
after 20 mili seconds.If I specify timeinterval as 20 mili second in
XtAppAddTimeOut function its calling fun method after 30 mili seconds.
I am attaching my code .

Solaris Version I am using it Solaris 10 updated 9
X11c library version is libX11.so.5

Please let me know if there is any fix available for it .
#include <X11/Intrinsic.h>	// needed for callback management
#include <sys/time.h>
#include <time.h>
#include<iostream>
#include <unistd.h>   
#include <stdlib.h>     /* General Utilities */
#include <signal.h>
using namespace std;
XtIntervalId main_timer;
static XtAppContext app_context;
unsigned long interval=10;
void setup();
void fun()
{
	 time_t curtime;
	 char buffer[30];
	 struct timeval tv;
	 gettimeofday(&tv, NULL);
	 curtime=tv.tv_sec;

	 strftime(buffer,30,"%m-%d-%Y  %T.",localtime(&curtime));
	//printf("%s%ld\n",buffer,tv.tv_usec/1000);
	cout<<buffer<<"-"<<tv.tv_usec/1000<<"##EXIT##Received SIGTERM signal"<<endl;
	//LOG_AXIS_INFO("##EXIT##Received SIGTERM signal");
	setup();
}

void TimeOutCB(XtPointer  cl_data, XtIntervalId *timer)
{
   fun();
}

void setup()
{
	//setup();
	XtAppAddTimeOut(app_context, interval, TimeOutCB, NULL);
}

int main(int argc, char *argv[])
{
         argc = 2;
         char* argv1[]  = {"One", "Two"};

	XtVaAppInitialize (&app_context, "ConfigFileReaderTest", NULL, 0, &argc, argv1, NULL, NULL);
	setup();
//	signal( SIGTERM, handleSigTerm );
		while(1)
	    {
			XtAppProcessEvent(app_context, XtIMAll);
	     }
		return 0;
}

_______________________________________________
xwin-discuss mailing list
[email protected]
List info: http://mail.opensolaris.org/mailman/listinfo/xwin-discuss
Unsubscribe: http://mail.opensolaris.org/mailman/options/xwin-discuss

Reply via email to