How GUI app include a interrupt resource manager ?

Hi, group,

Thanks for your helpful replies for interrupt in photon application.

The application I’m making needs much the same code as follows as a resource manager. I must add it into the application somewhere.

void interrupt_thread (void * data)
{
… …
/
intNum is the desired interrupt level */
id = InterruptAttachEvent (INTNUM, &event, 0);

while (1) {
    InterruptWait (NULL, NULL);
    /* some decoder code here, then update a string widget, that's all */
     PtSetResource(ABW_text_widget,Pt_ARG_TEXT_STRING,new_num, 0);

     *  unmask the interrupt when done
     */
    InterruptUnmask(INTNUM, id);
}

}

int main(int argc, char argv) {
… …
/
resouce manager init
/

/* Start the thread which will handle interrupt events. */
pthread_create (NULL, NULL, interrupt_thread, NULL);

/* Never returns */
thread_pool_start(tpp);

}

I use phAB compile the program. abmain.c is the mainline function it generates. As normally, I may add the code above into it, but the help tells me not to modify abmain.c. Sequentlly, I’ve no idea what to do about it. I had tried modify indSfiles to include the code above, but it seems ineffective. I think the way is to include a interrupt resouce manager
into the application.

Any idea ?

Best regards

Peter Z
pzdec26@1010.com

I don’t recall the details but you can setup an init functiion which is where you would put your stuff.

You cannot modificy the main function because photon as it’s own main loop, hence you can’t mix Photon event handling and resource manager handling from the main.

  • Mario