Function registered by XtAppAddWorkProc is called many times

272 Views Asked by At

I've register a function to work on background by below code:

XtAppAddWorkProc(app, (XtWorkProc)NotifyEntryCallback, (XtPointer)ent);

It wil be ok if I just call this function once in a task (click on a button for example). But when I call it twice or more in that task, NotifyEntryCallback will be called many time (infinity).

I try to store XtAppAddWorkProc use XtRemoveWorkProc function to remove the registered function but it still does not work.

I has spent many times on Google but cannot know why this happens. Please help me to resolve it.

1

There are 1 best solutions below

0
On BEST ANSWER

Finally, I find the solution. I share it for anyone faces the same issue:

The return value in XtWorkProc tell system call registered function again or not. In this case, NotifyEntryCallback should return True if I don't want it to be called again.

Reference link: http://home.soka.ac.jp/~unemi/Motif/man3/XtWorkProc.html