Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#860 closed defect (fixed)

omic::DNA is not thread safe

Reported by: Peter Owned by: Peter
Priority: trivial Milestone: yat 0.14
Component: omic Version: trunk
Keywords: Cc:

Description

The DNA class contains static variables, which means there is a potential race condition if multiple threads reach the init() unction at the same time.

void init(void) {
  if (!char2code_.empty())
    return;
  char2code_.resize(128,255);
  code2char_ = " ACMGRSVTWYHKDBN";

  for (unsigned short i=0; i<code2char_.size(); ++i)
    char2code_[static_cast<size_t>(code2char_[i])] = i;
}

Change History (2)

comment:1 Changed 6 years ago by Peter

Resolution: fixed
Status: newclosed

(In [3502]) Avoid static variables. fixes #860.

comment:2 Changed 6 years ago by Peter

Milestone: yat 0.x+yat 0.14
Note: See TracTickets for help on using tickets.