OSSP CVS Repository

ossp - Ticket #158
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 158: pthread library from ex(3) manpage may cause another segfault

If the pthread module from the man page is used, pthread_init() sets the function to retrieve the exception context (__ex_ctx) to pthread_ex_ctx(). This function only results with a pointer to an exception context struct when there was that data assiciated to the thread before with pthread_setspecific() which is always done when a thread is created with the create wrapper. But for the main program thread pthread_getspecific returns NULL resulting in a segmantation fault when NULL is referenced later on (this usually occurs in the ex_try macro when accessing the machine context). The attached patch returns the static exception context as __ex_ctx_default() does in the case pthread_getspecific() returns NULL. It also uses the default termination function in pthread_ex_terminate in this case.
[Add remarks]

Remarks:

Properties:

Type: code           Version:  
Status: fixed          Created: 2007-Aug-28 07:13
Severity:          Last Change: 2007-Oct-12 21:58
Priority:          Subsystem: ex 
Assigned To: rse           Derived From:  
Creator: anonymous 

Related Check-ins:

2007-Oct-12 21:57 Check-in [5973]: Fix example given under "MULTITHREADING ENVIRONMENTS" in the manual page. The problem is that the context can be still not associated and hence be NULL. Submitted by: Frank Hempel <red_socks@gmx.de> (By rse)

Attachments:

CVSTrac 2.0.1