Refresh and loop question

hi all,
i have a little problem.

i have 2 functions fcnCreateWindows this one creates some widgets and display a message “Press Enter to continue”, and my other function fcnExecuteProgram, this one executes a program wich has a loop and waits for a reveicing signal which is received by a PCI card, everything works fine, except the redraw of the graphics, the problem is that the funciotion fcnCreateWindows is not making its job, until fcnExecuteProgram its done,

fcnCreateWindows(); // it must display a message
fcnExecuteProgram(); // has a loop and everything works fine

// the message is not displayed before function 2

any1 have some solution to this problem ??

thanks in advance, any help will be apreciated.

// Marcopolo

I think a way of fixing this is using threads, but i have no clue of how to use them, so if u think there’s another solution ill apreciate it, also if u have a small example of how can i use threads that would be excelent.
thanks in advance

basically i have this

fcnDisplayWindow // this displays some windows and msgs
fcnGetbutton // Receives a buton pressed

and fcnGetbutton is like this

int fcnGetbutton()
int data = 0;
while (data != 0x0001) // if pin1 = 1 then exits
RegRead(0,WORDA,data); // reads from word A,
// insert magic instruction here

what i need is an istruction to release the processor, because when the program is in the loop the window is not drawing the windows and messages, do any1 here have some suggestion ?

if any1 have an idea, plz post it


Yes, of course use threads. If what you want to do is that several tasks “run at the same time (sharing the CPU)”, the way to do this is to use threads.

I recommend you the book:

Getting Started with QNX Neutrino 2 – a Guide for Realtime Programmers of Rob Krten. Although all the concepts about how to create threads are common for QNX and Linux systems, in the book there are several examples of how to use threads in QNX.

Just using “google” I have found some examples (Search in Google for pthread_create, qnx), there are many examples ( i havent test them) … h_2a.shtml … ead_ab.htm … rial_4.php

And the Rob Krten´s book also.

And of course, in the QNX documentation (the best place) there are also some examples: … reate.html

I hope it helps.

thanks for ur post, ill try it out, after dinner,

and thanks