pkgsrc/sysutils/gnome-vfs/patches/patch-ae
rh 4ee0b46b0d Update gnome-vfs to 1.0. Changes include performance improvements through
a revamped pthread backend, several API cleanups, and numerous bug fixes.
2001-04-06 22:03:07 +00:00

74 lines
2 KiB
Text

$NetBSD: patch-ae,v 1.1 2001/04/06 22:03:09 rh Exp $
--- libgnomevfs-pthread/gnome-vfs-job.c.orig Thu Apr 5 17:46:13 2001
+++ libgnomevfs-pthread/gnome-vfs-job.c
@@ -166,13 +166,21 @@
* access lock at all in the case of synch operations like xfer.
* Unlocking here is perfectly OK, even though it's a hack.
*/
+#ifdef HAVE_SEMAPHORE_H
sem_post (&job->access_lock);
+#else
+ pthread_mutex_unlock (&job->access_lock);
+#endif
JOB_DEBUG (("Wait notify condition %u", GPOINTER_TO_UINT (notify_result->job_handle)));
/* Wait for the notify condition. */
g_cond_wait (job->notify_ack_condition, job->notify_ack_lock);
+#ifdef HAVE_SEMAPHORE_H
sem_wait (&job->access_lock);
+#else
+ pthread_mutex_lock (&job->access_lock);
+#endif
JOB_DEBUG (("Unlock notify ack lock %u", GPOINTER_TO_UINT (notify_result->job_handle)));
/* Acknowledgment got: unlock the mutex. */
@@ -564,7 +572,11 @@
GnomeVFSOp *op;
JOB_DEBUG (("locking access lock %u, op %d", GPOINTER_TO_UINT (job->job_handle), type));
+#ifdef HAVE_SEMAPHORE_H
sem_wait (&job->access_lock);
+#else
+ pthread_mutex_lock (&job->access_lock);
+#endif
op = g_new (GnomeVFSOp, 1);
op->type = type;
@@ -588,7 +600,11 @@
new_job = g_new0 (GnomeVFSJob, 1);
+#ifdef HAVE_SEMAPHORE_H
sem_init (&new_job->access_lock, 0, 1);
+#else
+ pthread_mutex_init (&new_job->access_lock, NULL);
+#endif
new_job->notify_ack_condition = g_cond_new ();
new_job->notify_ack_lock = g_mutex_new ();
@@ -610,7 +626,11 @@
gnome_vfs_op_destroy (job->op);
+#ifdef HAVE_SEMAPHORE_H
sem_destroy (&job->access_lock);
+#else
+ pthread_mutex_destroy (&job->access_lock);
+#endif
g_cond_free (job->notify_ack_condition);
g_mutex_free (job->notify_ack_lock);
@@ -705,7 +725,11 @@
JOB_DEBUG (("new job %u, op %d, unlocking access lock",
GPOINTER_TO_UINT (job->job_handle), job->op->type));
+#ifdef HAVE_SEMAPHORE_H
sem_post (&job->access_lock);
+#else
+ pthread_mutex_unlock (&job->access_lock);
+#endif
}
#define DEFAULT_BUFFER_SIZE 16384