At present, an exception could be thrown in a pthread and
fail to be caught, in which case, behaviour is undefined.

This can be fixed as follows: given the client init
procedure cp, and client data pointer cd, instead of
calling pthread.init(cp,fp) [pseudo code!] we instead
do this:

struct cpd_wrapper {
  pthread_init_proc_t *cp;
  void *cd;
}

pthread.init(fixed_routine, new cpd_wrapper(cp,cd));

void fixed_routine(void *vcpd) {
  cpd_wrapper *cpd = (cpd_wrapper*)vcpd;
  pthread_init_proc_t *cp = cpd->cp;
  void *cd = cpd->cd;
  delete cpd;  
  try { cp(cd); }
  catch (...) { abort(); }
}

This is completely transparent, but ensures that an uncaught
exception will be detected.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to