Make variables thread local

This commit is contained in:
Andreas Fabri 2016-08-31 14:05:22 +02:00
parent 641d5d51ef
commit c3ac74d4de
1 changed files with 12 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#include <CGAL/utility.h>
#include <CGAL/Iterator_project.h>
#include <CGAL/function_objects.h>
#include <CGAL/tss.h>
namespace CGAL {
@ -87,7 +88,14 @@ private:
Segment_2 *left_seg;
Segment_2 *top_seg;
Segment_2 *bot_seg;
static SEG_Direction seg_dir;
static SEG_DIR& direction()
{
CGAL_STATIC_THREAD_LOCAL_VARIABLE(SEG_Direction, seg_dir,SEG_UP);
return seg_dir;
}
public:
Hot_pixel(const Point_2 & inp_point, NT inp_pixel_size);
@ -99,12 +107,12 @@ public:
bool intersect_bot(const Segment_2 & seg, SEG_Direction seg_dir) const;
bool intersect_top(const Segment_2 & seg, SEG_Direction seg_dir) const;
bool intersect(Segment_data & seg, SEG_Direction seg_dir) const;
void set_direction(SEG_Direction inp_seg_dir) { seg_dir = inp_seg_dir; }
SEG_Direction get_direction() const { return(seg_dir); }
void set_direction(SEG_Direction inp_seg_dir) { direction() = inp_seg_dir; }
SEG_Direction get_direction() const { return direction(); }
};
/*! */
template<class Traits_> SEG_Direction Hot_pixel<Traits_>::seg_dir;
//template<class Traits_> SEG_Direction Hot_pixel<Traits_>::seg_dir;
// a function for compare two hot pixels for the set of hot pixels
template<class Traits_>