summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3975a2b)
It is a good programming practice to verify a system
call has indeed succeed.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
void init_threads() {
volatile int i;
void init_threads() {
volatile int i;
#if !defined(_MSC_VER)
pthread_t pthread[1];
#if !defined(_MSC_VER)
pthread_t pthread[1];
for (i = 1; i < THREAD_MAX; i++)
{
#if !defined(_MSC_VER)
for (i = 1; i < THREAD_MAX; i++)
{
#if !defined(_MSC_VER)
- pthread_create(pthread, NULL, init_thread, (void*)(&i));
+ ok = (pthread_create(pthread, NULL, init_thread, (void*)(&i)) == 0);
- CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, iID);
+ ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, iID) != NULL);
+ if (!ok)
+ {
+ cout << "Failed to create thread number " << i << endl;
+ Application::exit_with_failure();
+ }
+
// Wait until the thread has finished launching
while (!Threads[i].running);
}
// Wait until the thread has finished launching
while (!Threads[i].running);
}
// If this thread has been assigned work, launch a search
if (Threads[threadID].workIsWaiting)
{
// If this thread has been assigned work, launch a search
if (Threads[threadID].workIsWaiting)
{
+ assert(!Threads[threadID].idle);
+
Threads[threadID].workIsWaiting = false;
if (Threads[threadID].splitPoint->pvNode)
sp_search_pv(Threads[threadID].splitPoint, threadID);
Threads[threadID].workIsWaiting = false;
if (Threads[threadID].splitPoint->pvNode)
sp_search_pv(Threads[threadID].splitPoint, threadID);