Dear All,
To start a thread in a Photon app I specified an initialization function in PhAB and duplicated all of the code in main() that occured after the initialization function call within the init function. (ugly)
Now I can generate code in PhAB without overwriting calls which should occur in main(). I think the duplication is ugly, does anyone have any suggestions?
Thanks.
int
main ( int argc, char *argv[] )
{
Ap.Ap_winstate = 0;
/* AppBuilder Initialization */
ApInitialize( argc, argv, &AbContext );
initialize_vvmcontrol( argc, argv );
/* Display main window */
ApLinkWindow( NULL, &AbApplLinks[0], NULL );
/* Loop until user quits application */
PtMainLoop( );
PtExit( 0 );
return 0;
}
int
initialize_vvmcontrol( int argc, char* argv[] );
{
/* Display main window */
ApLinkWindow( NULL, &AbApplLinks[0], NULL );
/* start thread here */
/* Loop until user quits application */
PtMainLoop( );
PtExit( 0 );
return 0;
}
Kevin P. Ladenheim <Kevin.Ladenheim@jhuapl.edu> wrote:
To start a thread in a Photon app I specified an initialization
function in PhAB and duplicated all of the code in main() that occured
after the initialization function call within the init function. (ugly)
I agree it is ugly, but how does it start a thread?
Now I can generate code in PhAB without overwriting calls which should
occur in main(). I think the duplication is ugly, does anyone have any
suggestions?
I’m not sure what exactly you’re trying to do, but if you’re just trying
to start a thread, I’d recommend calling pthread_create(). Also, you
might want to check out PtEnter() and PtLeave() in the docs.
\
Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.
Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:
Thanks for the tips. I am wondering where the best place to call
pthread_create() would be in a Photon app for a thread that needs to run until app completion.
I’m not sure what exactly you’re trying to do, but if you’re just trying
to start a thread, I’d recommend calling pthread_create(). Also, you
might want to check out PtEnter() and PtLeave() in the docs.
\
Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.
Kevin P. Ladenheim <Kevin.Ladenheim@jhuapl.edu> wrote:
Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:
Thanks for the tips. I am wondering where the best place to call
pthread_create() would be in a Photon app for a thread that needs to run until app completion.
The initialization function would be my first choice.
–
Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.