Link to home
Start Free TrialLog in
Avatar of yossigordin
yossigordinFlag for Israel

asked on

starting the thread immediatly

Hi everybody,
how can i make the UI thread start immediatly. My problem is when i call the thread class just before the main thread enters a loop, the new window of the thread loads up after the loop is over.
Thanks a million.
yossi
Avatar of AlexFM
AlexFM

Use Sleep with some small value after starting of new thread:

Create thread
Sleep(50);             // let other threads to work
start loop

Avatar of Zoppo
or use syncronization, i.e. with an event object:
create a event, after starting the thread in main-thread
wait for the event to be signaled. In new thread signal the
event when you want the main-thread to be continued.

this is 100% safe method while simply using a 'Sleep' cannot
grant that the sub-thread reached the wanted functionality.

ZOPPO
Avatar of yossigordin

ASKER

Hi,
can you elaborate?
I understood the concept , but i can't implement it correctly.
can you help?
yossigordin
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
10nxs a lot for everything, but i manged to work it out without threads.
yossigordin