Skip to content

Commit

Permalink
sheet extension and index cleanup
Browse files Browse the repository at this point in the history
fix possible race condition w uibuff->index_started
on extension build, rebuild libzsvutil if stale
to do: consolidate index.c and transformation.c
       remove index.h from external api
       review writer.c for performance
  • Loading branch information
liquidaty committed Dec 19, 2024
1 parent 9e5d066 commit 49b75e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ uninstall:
rm -rf ${ZSV}

ZSV_UTIL_A=${LIBDIR}/libzsvutil.a

${ZSV_UTIL_A}:SQLITE_EXT=
${ZSV_UTIL_A}:SQLITE_EXT_INCLUDE=
${ZSV_UTIL_A}: ${BUILD_DIR}/objs/utils/util.a
Expand Down
2 changes: 1 addition & 1 deletion app/ext_example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@ ${TARGET} ${TARGET_SHEET}: ${BUILD_DIR}/bin/zsvext%.${SO} : %_extension.c ${LIBZ
@mkdir -p `dirname "$@"`
${CC} ${CFLAGS} ${CFLAGS_SHARED} $< -o $@ ${LIBS} ${YAJL_INCLUDE} ${YAJL_HELPER_INCLUDE}

.PHONY: all test test-% clean install
.PHONY: all test test-% clean install ${PREFIX}/lib/libzsvutil.a
3 changes: 2 additions & 1 deletion app/sheet/read-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ static int read_data(struct zsvsheet_ui_buffer **uibufferp, // a new zsvsheet_
pthread_mutex_lock(&uibuff->mutex);
char need_index = !uibuff->index_started && !uibuff->write_in_progress;
char *old_ui_status = uibuff->status;
if(need_index)
uibuff->index_started = 1;
pthread_mutex_unlock(&uibuff->mutex);

if (need_index) {
Expand All @@ -215,7 +217,6 @@ static int read_data(struct zsvsheet_ui_buffer **uibufferp, // a new zsvsheet_

uibuff->buff_used_rows = rows_read;
uibuff->dimensions.row_count = rows_read;
uibuff->index_started = 1;
if (original_row_num > 1 && rows_read > 0) {
opts.stream = NULL;
get_data_index_async(uibuff, filename, &opts, custom_prop_handler, old_ui_status);
Expand Down

0 comments on commit 49b75e0

Please sign in to comment.