mu-utils-file: remove some unused code

This commit is contained in:
Dirk-Jan C. Binnema
2026-03-17 08:46:15 +02:00
committed by Seth Ladygo
parent 36451502ac
commit 3c4b50e7a2
2 changed files with 1 additions and 62 deletions

View File

@ -1,5 +1,5 @@
/* /*
** Copyright (C) 2023-2024 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2023-2026 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the ** under the terms of the GNU General Public License as published by the
@ -176,56 +176,6 @@ Mu::runtime_path(Mu::RuntimePath path, const std::string& muhome)
} }
} }
/* LCOV_EXCL_START*/
static gpointer
cancel_wait(gpointer data)
{
guint timeout, deadline;
GCancellable *cancel;
cancel = (GCancellable*)data;
timeout = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(cancel), "timeout"));
deadline = g_get_monotonic_time() + 1000 * timeout;
while (g_get_monotonic_time() < deadline && !g_cancellable_is_cancelled(cancel)) {
g_usleep(50 * 1000); /* 50 ms */
g_thread_yield();
}
g_cancellable_cancel(cancel);
return NULL;
}
static void
cancel_wait_free(gpointer data)
{
GThread *thread;
GCancellable *cancel;
cancel = (GCancellable*)data;
thread = (GThread*)g_object_get_data(G_OBJECT(cancel), "thread");
g_cancellable_cancel(cancel);
g_thread_join(thread);
}
GCancellable*
Mu::g_cancellable_new_with_timeout(guint timeout)
{
GCancellable *cancel;
cancel = g_cancellable_new();
g_object_set_data(G_OBJECT(cancel), "timeout", GUINT_TO_POINTER(timeout));
g_object_set_data(G_OBJECT(cancel), "thread",
g_thread_new("cancel-wait", cancel_wait, cancel));
g_object_set_data_full(G_OBJECT(cancel), "cancel", cancel, cancel_wait_free);
return cancel;
}
/* LCOV_EXCL_STOP*/
/* LCOV_EXCL_START*/ /* LCOV_EXCL_START*/
Result<std::string> Result<std::string>
Mu::read_from_stdin() Mu::read_from_stdin()

View File

@ -186,17 +186,6 @@ std::string join_paths(S&& s, Args...args) {
return path; return path;
} }
/**
* Like g_cancellable_new(), but automatically cancels itself
* after timeout
*
* @param timeout timeout in millisecs
*
* @return A GCancellable* instances; free with g_object_unref() when
* no longer needed.
*/
GCancellable* g_cancellable_new_with_timeout(guint timeout);
/** /**
* Read for standard input * Read for standard input
* *