-
-
Notifications
You must be signed in to change notification settings - Fork 73
Some field-of-view implementations are not reentrant. #47
Copy link
Copy link
Closed
Labels
Description
There are several implementations which are using non-const global variables. These prevent the algorithms from being thread-compatible.
libtcod/src/libtcod/fov_diamond_raycasting.c
Lines 49 to 52 in 0891874
| static int origx,origy; /* fov origin */ | |
| static ray_data_t **raymap; /* result rays */ | |
| static ray_data_t *raymap2; /* temporary rays */ | |
| static int perimidx; |
libtcod/src/libtcod/fov_permissive2.c
Lines 49 to 52 in 0891874
| /* Defines the parameters of the permissiveness */ | |
| /* Derived values defining the actual part of the square used as a range. */ | |
| static int offset; | |
| static int limit; |
libtcod/src/libtcod/fov_permissive2.c
Lines 67 to 70 in 0891874
| static view_t **current_view=NULL; | |
| static view_t *views=NULL; | |
| static viewbump_t *bumps=NULL; | |
| static int bumpidx=0; |
libtcod/src/libtcod/fov_restrictive.c
Lines 42 to 46 in 0891874
| /* angle ranges */ | |
| double * start_angle = NULL; | |
| double * end_angle = NULL; | |
| /* number of allocated angle pairs */ | |
| int allocated = 0; |
These variables need to be moved into the stack so that they can't be overwritten by reentrant calls.
Reactions are currently unavailable