Compare commits
No commits in common. "7ee54bddf291c153b6a22d5331aa520d97f4be06" and "3dfc258fa414d62a8c201bdaad29fbe6128280e2" have entirely different histories.
7ee54bddf2
...
3dfc258fa4
2 changed files with 1 additions and 18 deletions
|
@ -2,12 +2,6 @@
|
|||
|
||||
## Upcoming Changes
|
||||
|
||||
## Version 1.3
|
||||
|
||||
Prevent `simplearchiver` from busy-waiting during non-blocking IO by sleeping
|
||||
in "EWOULDBLOCK" conditions. This results in less consumed cpu time by the
|
||||
process, especially during compression.
|
||||
|
||||
## Version 1.2
|
||||
|
||||
Proper handling of Ctrl+C (SIGINT). This prevents temporary files from
|
||||
|
|
|
@ -64,8 +64,6 @@ void handle_sig_int(int sig) {
|
|||
is_sig_int_occurred = 1;
|
||||
}
|
||||
}
|
||||
|
||||
const struct timespec nonblock_sleep = {.tv_sec = 0, .tv_nsec = 1000000};
|
||||
#endif
|
||||
|
||||
typedef struct SDArchiverInternalToWrite {
|
||||
|
@ -299,7 +297,6 @@ int write_files_fn(void *data, void *ud) {
|
|||
ret = write(pipe_into_cmd[1], write_buf, write_count);
|
||||
if (ret == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
write_again = 1;
|
||||
} else {
|
||||
// Error during write.
|
||||
|
@ -357,7 +354,7 @@ int write_files_fn(void *data, void *ud) {
|
|||
// fprintf(stderr, "read_done\n");
|
||||
} else if (ret == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
// Nop.
|
||||
} else {
|
||||
// Read error.
|
||||
fprintf(stderr,
|
||||
|
@ -1174,7 +1171,6 @@ int read_decomp_to_out_file(const char *out_filename, int in_pipe,
|
|||
} else {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// Non-blocking read from pipe.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
continue;
|
||||
} else {
|
||||
// Error.
|
||||
|
@ -1214,7 +1210,6 @@ int read_decomp_to_out_file(const char *out_filename, int in_pipe,
|
|||
} else {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// Non-blocking read from pipe.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
continue;
|
||||
} else {
|
||||
// Error.
|
||||
|
@ -2441,7 +2436,6 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state,
|
|||
// Non-blocking write.
|
||||
has_hold = (int)fread_ret;
|
||||
memcpy(hold_buf, buf, fread_ret);
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
} else {
|
||||
fprintf(
|
||||
stderr,
|
||||
|
@ -2468,7 +2462,6 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state,
|
|||
if (write_ret < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// Non-blocking write.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
} else {
|
||||
return SDAS_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -2491,7 +2484,6 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state,
|
|||
if (read_ret < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// Non-blocking read.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"ERROR: Reading from compressor, pipe read error!\n");
|
||||
|
@ -2526,7 +2518,6 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state,
|
|||
if (read_ret < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// Non-blocking read.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"ERROR: Reading from compressor, pipe read error!\n");
|
||||
|
@ -3163,7 +3154,6 @@ int simple_archiver_parse_archive_version_0(FILE *in_f, int_fast8_t do_extract,
|
|||
}
|
||||
} else if (write_ret == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
write_again = 1;
|
||||
} else {
|
||||
// Error.
|
||||
|
@ -3207,7 +3197,6 @@ int simple_archiver_parse_archive_version_0(FILE *in_f, int_fast8_t do_extract,
|
|||
} else if (read_ret == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
// No bytes to read yet.
|
||||
nanosleep(&nonblock_sleep, NULL);
|
||||
} else {
|
||||
// Error.
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in a new issue