LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - General (http://www.linuxquestions.org/questions/forumdisplay.php?f=1)
-   -   FATAL: Exception occurred with pthread_exit() (http://www.linuxquestions.org/questions/showthread.php?t=603223)

platso 11-29-2007 06:43 AM

FATAL: Exception occurred with pthread_exit()
 
We had written an application in which we create worker thread.

So the main thread will create the worker thread. After some time
the child thread(Worker thread) will call pthread_exit().
This function was written in try{} and there occured an Exception and is handled in catch(...) handler.

This is on Linux platform. Fedora Core 6 and gcc 4.1.

The Implementation of the code is as follows:
This is a simple form of our application, Try to run this small piece
of code.

The output of this is " FATAL: exception not rethrown
Inside catch... Aborted"

#include <stdio.h>
#include <stdlib.h>
#include <stdexcept.h>
#include <pthread.h>

using namespace std;

void print_message_function( void *ptr );
int main()
{
pthread_t thread1;
char *message1 = "Thread 1";
int iret1;

iret1 = pthread_create( &thread1, NULL, (void*(*)(void*))&print_message_function, (void*) message1);

pthread_join( thread1, NULL);


}

void print_message_function( void *ptr )
{
char *message;
message = (char *) ptr;

try
{
pthread_exit((void*) 1);
}
catch(...)
{
printf("Inside catch...\n");
}
}



CAN ANY ONE TELL ME THE REASON FOR THIS EXCEPTION?

acid_kewpie 11-30-2007 02:02 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

v00d00101 11-30-2007 04:01 AM

Not to mention it should have been posted in Programming.


All times are GMT -5. The time now is 05:33 AM.