Skip to content

Commit

Permalink
Fix GIL release for to_columns_string()
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Aug 7, 2023
1 parent ff59bb9 commit eca996a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions cpp/perspective/src/cpp/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,10 +1580,10 @@ View<t_ctxunit>::to_columns(t_uindex start_row, t_uindex end_row,
bool get_pkeys, bool get_ids, bool _leaves_only, t_uindex num_sides,
bool _has_row_path, std::string nidx, t_uindex columns_length,
t_uindex group_by_length) const {

PSP_GIL_UNLOCK();
PSP_READ_LOCK(get_lock());
auto slice = get_data(start_row, end_row, start_col, end_col);
auto col_names = slice->get_column_names();
auto schema = m_ctx->get_schema();
auto& col_names = slice->get_column_names();

rapidjson::StringBuffer s;
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
Expand Down Expand Up @@ -1628,9 +1628,12 @@ View<t_ctx0>::to_columns(t_uindex start_row, t_uindex end_row,
bool get_pkeys, bool get_ids, bool _leaves_only, t_uindex num_sides,
bool _has_row_path, std::string nidx, t_uindex columns_length,
t_uindex group_by_length) const {
PSP_GIL_UNLOCK();
PSP_READ_LOCK(get_lock());
auto slice = get_data(start_row, end_row, start_col, end_col);
auto col_names = slice->get_column_names();
auto schema = m_ctx->get_schema();
const std::vector<std::vector<t_tscalar>>& col_names
= slice->get_column_names();

rapidjson::StringBuffer s;
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
writer.StartObject();
Expand Down Expand Up @@ -1671,8 +1674,11 @@ View<t_ctx1>::to_columns(t_uindex start_row, t_uindex end_row,
bool get_pkeys, bool get_ids, bool leaves_only, t_uindex num_sides,
bool has_row_path, std::string nidx, t_uindex columns_length,
t_uindex group_by_length) const {
PSP_GIL_UNLOCK();
PSP_READ_LOCK(get_lock());

auto slice = get_data(start_row, end_row, start_col, end_col);
auto col_names = slice->get_column_names();
const auto& col_names = slice->get_column_names();
rapidjson::StringBuffer s;
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
writer.StartObject();
Expand Down Expand Up @@ -1721,8 +1727,10 @@ View<t_ctx2>::to_columns(t_uindex start_row, t_uindex end_row,
bool get_pkeys, bool get_ids, bool leaves_only, t_uindex num_sides,
bool has_row_path, std::string nidx, t_uindex columns_length,
t_uindex group_by_length) const {
auto slice = get_data(start_row, end_row, start_col, end_col);
auto col_names = slice->get_column_names();
PSP_GIL_UNLOCK();
PSP_READ_LOCK(get_lock());
const auto slice = get_data(start_row, end_row, start_col, end_col);
const auto& col_names = slice->get_column_names();
rapidjson::StringBuffer s;
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
writer.StartObject();
Expand Down

0 comments on commit eca996a

Please sign in to comment.