Some questions regarding exception vs. multiple-thread :
1. there are one main thread and one child thread. the child thread may throw one exception but it doesn't try to catch any exception. in the main thread, it tries to catch excpetion. Can main thread catch the exception that is thrown from child thread?
2. if child tread may throw exception, and neither main tread nor child tread will catch exception. What is the consequence if the child tread really throws one exception. Which tread is crash? Or both crash?
However this all depends on how thread-aware the C++ library is. The best thing to do is for a C++ thread created with pthread_create to have a try/catch(...) block to stop C++ threads trying to unwind through pthread library.
eg
Not all platforms support mixing pthread_cleanup_push/pop with C++ local objects.
G++ is appalling with exceptions and threads. For example calling pthread_exit() should cause all local objects to destruct. Sun's Studio11 does this correctly.
Hi folks,
I have logs folder in which different type of logs are generated , I am monitoring them by the below command
tail -f *.log
but I want that if exception come in any of the logs then it should be catch so what i should prefix with tail -f *.log so that it imeediatley catches and... (3 Replies)
Hi Folks,
please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Hi all,
Can I create multiple threads using single thread_id
like
pthread_t thread_id;
pthread_create(&thread_id, NULL, &print_xs, NULL);
pthread_create(&thread_id, NULL, &print_ys, NULL);
pthread_create(&thread_id, NULL, &print_zs, NULL);
pthread_join(thread_id, NULL);
what... (2 Replies)
Thanks everyone for the wonderful and helping environment..
And the problem I asked.. forget it... 4 days wait for a decent reply was such a moral booster.. (3 Replies)
Hi Friends,
I have written a program which will listener for more than 1000 requests per second from a single socket descriptor and then it will process those requestes. Its taking X amount of time. Now i want to reduce that time. Will I can write multiple threads to receive the... (2 Replies)