Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rpm-software-management/createrepo_c.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2022-08-09 08:58:39 +0300
committeramatej <matej.ales@seznam.cz>2022-11-03 18:51:36 +0300
commit269bb3b4f6426082a560017a80b9b014180dbc0e (patch)
treeb14cc7e095d4bc8a9a252a2e84f5b191e2b885dc
parent04dbb52adf3955db866c381f1ab095391293af0a (diff)
New helper wait_for_incremented_ids()
Will be needed later for the "skip" mechanism.
-rw-r--r--src/dumper_thread.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/src/dumper_thread.c b/src/dumper_thread.c
index 5e499ba..777f7e4 100644
--- a/src/dumper_thread.c
+++ b/src/dumper_thread.c
@@ -62,6 +62,32 @@ buf_task_sort_func(gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer data
static void
+wait_for_incremented_ids(long id, struct UserData *udata)
+{
+ g_mutex_lock(&(udata->mutex_pri));
+ while (udata->id_pri != id)
+ g_cond_wait (&(udata->cond_pri), &(udata->mutex_pri));
+ ++udata->id_pri;
+ g_cond_broadcast(&(udata->cond_pri));
+ g_mutex_unlock(&(udata->mutex_pri));
+
+ g_mutex_lock(&(udata->mutex_fil));
+ while (udata->id_fil != id)
+ g_cond_wait (&(udata->cond_fil), &(udata->mutex_fil));
+ ++udata->id_fil;
+ g_cond_broadcast(&(udata->cond_fil));
+ g_mutex_unlock(&(udata->mutex_fil));
+
+ g_mutex_lock(&(udata->mutex_oth));
+ while (udata->id_oth != id)
+ g_cond_wait (&(udata->cond_oth), &(udata->mutex_oth));
+ ++udata->id_oth;
+ g_cond_broadcast(&(udata->cond_oth));
+ g_mutex_unlock(&(udata->mutex_oth));
+}
+
+
+static void
write_pkg(long id,
struct cr_XmlStruct res,
cr_Package *pkg,
@@ -612,26 +638,7 @@ task_cleanup:
if (udata->id_pri <= task->id) {
// An error was encountered and we have to wait to increment counters
- g_mutex_lock(&(udata->mutex_pri));
- while (udata->id_pri != task->id)
- g_cond_wait (&(udata->cond_pri), &(udata->mutex_pri));
- ++udata->id_pri;
- g_cond_broadcast(&(udata->cond_pri));
- g_mutex_unlock(&(udata->mutex_pri));
-
- g_mutex_lock(&(udata->mutex_fil));
- while (udata->id_fil != task->id)
- g_cond_wait (&(udata->cond_fil), &(udata->mutex_fil));
- ++udata->id_fil;
- g_cond_broadcast(&(udata->cond_fil));
- g_mutex_unlock(&(udata->mutex_fil));
-
- g_mutex_lock(&(udata->mutex_oth));
- while (udata->id_oth != task->id)
- g_cond_wait (&(udata->cond_oth), &(udata->mutex_oth));
- ++udata->id_oth;
- g_cond_broadcast(&(udata->cond_oth));
- g_mutex_unlock(&(udata->mutex_oth));
+ wait_for_incremented_ids(task->id, udata);
}
g_free(task->full_path);