X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.4 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_93,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Thu, 23 Jul 2009 15:50:11 +0200 Message-ID: <1de9d39c0907230650t3ae02e2agc540e9ef8fe4ca34@mail.gmail.com> Subject: strange behavior with threads... From: jean-luc malet To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi! I've the following code : void _Window::Start(void* arg) { ThreadArgs args; args.TheWindow=3Dthis; args.args=3Darg; int err =3D pthread_create(&main_thread,NULL,_Start, (void*)&args); if (err) { throw new Exception(err, "window thread creation error"); } } void* _Window::_Start(void* arg) { ThreadArgs* args =3D (ThreadArgs*) arg; pthread_exit((void*)args->TheWindow->start_routine(args->args)); } _Window::_Start is static for some reason that I can't determine it happens that args in _Window::_Start have strange value (args->TheWindow don't contain a valid pointer, ie a pointer on a _Window object) this happens on 2 thread configuration upon creation of the second thread (1rst thread is main() and do only create the Window and sleep) It happens randomly and backtrace on crash don't contain any usefull information (looks exactly like the one when args->TheWindow is correct) I didn't tested on other posix system thanks for your help Regards JLM --=20 KISS! (Keep It Simple, Stupid!) (garde le simple, imb=C3=A9cile!) "mais qu'est-ce que tu m'as pondu comme usine =C3=A0 gaz? fait des choses simples et qui marchent, esp=C3=A8ce d'imb=C3=A9cile!" ----------------------------- "Si vous pensez que vous =C3=AAtes trop petit pour changer quoique ce soit, essayez donc de dormir avec un moustique dans votre chambre." Betty Reese http://www.grainesdechangement.com/citations.htm -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple