![]() |
|
#1
|
||||
|
||||
Multithreading problemI am running a multi threaded program, and it seems like the threads simply don't run.
Here is a short summary of my code (changed the names of classes and cut off unnecessary code): these are files from Core.dll project CPP / C++ / C Code:
in my exe project (lets call it myEXE.exe) i have this file: CPP / C++ / C Code:
The problem is that the threads don't seem to run (i never get the line "SENDER THREAD FUNC STARTED" or "RECEIVER THREAD FUNC STARTED"). Any ideas? |
|
#2
|
||||
|
||||
|
it seems like the threads exit right after they start, while debugging i get
Quote:
StartThreads(); |
|
#3
|
|||
|
|||
|
printf() would not be my first choice of an output debugging function for a thread created by CreateThread(). I would switch to OutputDebugString(). I would also make sure that main thread waits on the threads it creates to complete before exiting.
|
|
#4
|
||||
|
||||
|
Quote:
That was my problem, Instead of doing something like CPP / C++ / C Code:
or just a CPP / C++ / C Code:
I used a breakpoint, apparantly taht wasn't enough. Thanx Last edited by dsmith : 25-Jul-2004 at 07:49.
|
|
#5
|
||||
|
||||
|
I am using posix threads, but I think they are really similar to the windows threads that you are using. What I have noticed is that if I treat the main function as a thread as well (by calling pthread_exit) in main, it will wait for the other threads to finish.
Example: CPP / C++ / C Code:
This will pause 1 second and print "Function 1 called", pause another second and print "Function 2 called", even though the flow control in main runs through to the end. I would be curious to see if the same is true with the windows threads that you are using. __________________
The best damn Sports Blog period. |
|
#6
|
||||
|
||||
|
nice idea dsmith, just tryied it out and your idea works also in windows (using win API function - "ExitThread(0)" ).
chhers ![]() |
Recent GIDBlog
Stupid Management Policies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C I/O problem | kelly80 | C Programming Language | 4 | 27-Apr-2004 21:15 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 08:53 |
| problem with php5 cgi installation | fab13 | Apache Web Server Forum | 3 | 19-Nov-2003 10:11 |
| problem to access htdocs folders | fraggle two | Apache Web Server Forum | 5 | 12-Nov-2003 01:40 |
| unwanted scrollbar problem | kelly001 | Web Design Forum | 3 | 24-Oct-2003 11:44 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The