Branch: Tag:

2014-12-04

2014-12-04 19:26:01 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Avoid threads_disable().

The Pike compiler now uses a dedicated reentrant lock instead
of the brute-force approach of using threads_disable().

This should improve concurrency with other threads.

307:    num >> 4, data);   }    - #ifdef _REENTRANT - static void do_enable_threads(void) - { -  exit_threads_disable(NULL); - } - #endif -  +    /* NOTE: Take care to encode it exactly as the corresponing    * type string would have been encoded (cf T_FUNCTION, T_MANY,    * T_STRING, PIKE_T_NSTRING).
3270:    char *dat=0;    struct program *p;    struct object *placeholder=0; -  ONERROR err1, err2, err3, err4; +  ONERROR err, err1, err2, err3, err4;    - #ifdef _REENTRANT -  ONERROR err; -  low_init_threads_disable(); -  SET_ONERROR(err, do_enable_threads, 0); - #endif +  lock_pike_compiler(); +  SET_ONERROR(err, unlock_pike_compiler, 0);       fprintf (stderr, "Warning: Using old-style encoding\n");   
3883:    }    }    - #ifdef _REENTRANT -  UNSET_ONERROR(err); -  exit_threads_disable(NULL); - #endif +  CALL_AND_UNSET_ONERROR(err);    goto decode_done;    }