Thanks. The #pragma definition was a savior. I don't know what I was doing wrong on the linker project settings, but this certainly works. Thanks again. :) :good:
Type: Posts; User: dimis
Thanks. The #pragma definition was a savior. I don't know what I was doing wrong on the linker project settings, but this certainly works. Thanks again. :) :good:
I wanted to measure time while using threads and I have some source code with which you can experiment here. Hope this helps.
Check my second post there (third post on thread). That's the one you...
Not only that. After else you should remove '()', after the conditions on your if statements remove ';', and after randgetal = rand() insert an ';'.
Now it will compile but you have no chance on...
Ok, a question with a different flavor.
I have to port to windows a simple program that used pthreads. For this purpose, I think this is ideal. I followed the instructions found on faq (mainly...
To be honest, my main concern was to print a message with the response time and not the cpu-time, so gettimeofday is exactly what I want. Still I don't see how you can measure the (sum of) time...
Thanks matsp. I think that gettimeofday () is exactly what I want. In fact it has an intuitive name and it was silly I didn't look for it earlier. :)
@brewbuck: I guess I don't get what you are...
The program with various things I tested until I found gettimeofday():
Output:
$ ./try 50000000
Clock ticks per second: 100
Just started counting!
All threads joined!
Duration 1: 12.0655...
getrusage has the same trouble with clock (). [tested]
Thanks Codeplug. However, these guys wanted to measure the time of each individual thread, which is not what I want. I figured out a solution though with gettimeofday () after searching for quite...
I don't know what to say. You are obviously right and I am obviously wrong. Justification soon. If I offended anyone I apologize; it was not my intention. Up until this post I made the mistake that...
After spending about an hour trying to figure out what was the problem that my threaded version of a program took more time than the single-core one, I think I rediscovered the wheel. Simply put, I...
I am not saying that more than one threads have locked the mutex. :) I am saying that more than one may assume that they have locked the mutex. Read my quote from the manual.
Wrong. The thread...
Now, on a second thought, I can solve all my (n00bish) ambiguities, by assigning a different queue to each "worker" and even use the 'if' statement version of the code. :)
Still though, I am...
... I don't get it. I already gave a "fake" example on how things might go wrong. The problem is that once at least 2 threads wake up, then all of them assume that the mutex is locked for them. Am I...
You can even use BootCamp with your Mac, install a minimal version of Windows just for compiling and creating executables, and you are done in *native* environment. :)
Hi,
I am new in pthread library and perhaps my question is naive. Anyway, here is the problem I want to solve. I want to create N >= 2 threads and one of them (from now on "generator") will always...