Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-25 Thread Robert Osfield
Hi Adam, On 9/24/07, Adam Coates [EMAIL PROTECTED] wrote: It looks like there's still a problem with the current setup. The Thread object itself can get deleted before the pthread actually gets to the lock (which, I guess is what you just added). If I understand correctly you are saying that

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-25 Thread Robert Osfield
Hi Adamn, On 9/25/07, Robert Osfield [EMAIL PROTECTED] wrote: On 9/24/07, Adam Coates [EMAIL PROTECTED] wrote: It looks like there's still a problem with the current setup. The Thread object itself can get deleted before the pthread actually gets to the lock (which, I guess is what you

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-24 Thread Robert Osfield
Hi Adam, I have recreated the crash, and have applied a fix to OpenThreads::Thread to resolve it. The fix involved added a Mutex to Thread which is used to prevent the startThread and destructor running in parallel. This certainly resolves the crash under Linux for my tests. I have rolled

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-24 Thread Adam Coates
Yup - builds fine, and it resolved the crash in my system as well. Thanks for taking care of it!! AC On 9/24/07, Robert Osfield [EMAIL PROTECTED] wrote: Hi Adam, I have recreated the crash, and have applied a fix to OpenThreads::Thread to resolve it. The fix involved added a Mutex to

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-24 Thread Adam Coates
Hey, Robert, It looks like there's still a problem with the current setup. The Thread object itself can get deleted before the pthread actually gets to the lock (which, I guess is what you just added). While it looks like this doesn't cause a crash, the problem is evidenced by valgrind (reports

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-20 Thread Adam Coates
Hi, Robert, The following is sufficient (basically what you said): #include OpenThreads/Thread class MyThread : public OpenThreads::Thread { public: void run(void) { } }; int main(int argc, char* argv[]) { { MyThread thread; thread.startThread(); } while(1) ; return 0; } You

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-20 Thread Adam Coates
Ah - just double-checked. It'll crash just fine without adding the usleep() to OpenThreads; I had my builds mixed up. AC On 9/20/07, Adam Coates [EMAIL PROTECTED] wrote: Hi, Robert, The following is sufficient (basically what you said): #include OpenThreads/Thread class MyThread :

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-20 Thread Robert Osfield
Hi Adam, Could you send the exact code that you can recreate the issue with. Robert. On 9/20/07, Adam Coates [EMAIL PROTECTED] wrote: Ah - just double-checked. It'll crash just fine without adding the usleep() to OpenThreads; I had my builds mixed up. AC On 9/20/07, Adam Coates [EMAIL

Re: [osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-20 Thread Adam Coates
I've attached the version I'm using that demonstrates the unusability of the isRunning() flag. The code pasted into the last e-mail is all that's necessary to illustrate the crash, though it doesn't try to avoid it using the 'isRunning' flag. You shouldn't need to modify the OpenThreads library.

[osg-users] OpenThreads threading bug on creation/deletion (leads to crashes)

2007-09-19 Thread Adam Coates
I ran into a crash caused (apprently) by OpenThreads (pthread implementation). If you create a new thread, and then immediately destroy it, it is possible to delete the thread before it has been flagged as running. Thus, whoever in osgViewer is waiting on the thread to close ends up deleting the