diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-02-12 01:25:53 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-02-12 01:25:53 +0000 |
commit | 5a8f3cd8adaabc814a916e225ff4af9c0689ac92 (patch) | |
tree | fd143874aff6f0291c08b1b2fd3dd87c49ec36c9 /libchannel | |
parent | becf233178d2cf402591e97d7a8499cafbbb7251 (diff) |
Fix build against libpthreadlibchannel
* channelio/Makefile (HURDLIBS): Remove threads.
(OTHERLIBS): Add -lpthread.
* channelio/open.h: Use pthread functions instead of cthreads functions.
* libchannel/broadcast.c: Likewise.
* libchannel/channel.h: Likewise.
* libchannel/hub.c: Likewise.
Diffstat (limited to 'libchannel')
-rw-r--r-- | libchannel/broadcast.c | 8 | ||||
-rw-r--r-- | libchannel/channel.h | 4 | ||||
-rw-r--r-- | libchannel/hub.c | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/libchannel/broadcast.c b/libchannel/broadcast.c index f25ae27fb..187457c25 100644 --- a/libchannel/broadcast.c +++ b/libchannel/broadcast.c @@ -51,7 +51,7 @@ broadcast_read (struct channel *channel, size_t amount, struct channel_hub *hub = channel->hub; struct broadcast_hook *hook = hub->hook; - mutex_lock (&hub->lock); + pthread_mutex_lock (&hub->lock); hook->wait_count++; if (hook->amount == 0 || amount < hook->amount) @@ -79,7 +79,7 @@ broadcast_read (struct channel *channel, size_t amount, memcpy (*buf, hook->buf, hook->amount); *len = hook->len; - mutex_unlock (&hub->lock); + pthread_mutex_unlock (&hub->lock); return 0; } @@ -114,13 +114,13 @@ broadcast_close (struct channel *channel) { struct broadcast_hook *hook = channel->hub->hook; - mutex_lock (&channel->hub->lock); + pthread_mutex_lock (&channel->hub->lock); hook->num_channels--; if (hook->num_channels == 0) channel_close (hook->channel); - mutex_unlock (&channel->hub->lock); + pthread_mutex_unlock (&channel->hub->lock); } diff --git a/libchannel/channel.h b/libchannel/channel.h index e2fc3e9a1..c1f267893 100644 --- a/libchannel/channel.h +++ b/libchannel/channel.h @@ -25,7 +25,7 @@ #ifndef __CHANNEL_H__ #define __CHANNEL_H__ -#include <cthreads.h> +#include <pthread.h> #include <mach.h> #include <hurd/hurd_types.h> @@ -43,7 +43,7 @@ struct channel_hub { /* Should be held when before access to fields of this hub or call to any function operating on it. */ - struct mutex lock; + pthread_pthread_mutex_t lock; /* The name of this hub. Its meaning is class-specific. May be null and is freed by channel_free_hub. */ diff --git a/libchannel/hub.c b/libchannel/hub.c index 0487d6660..f03c4253d 100644 --- a/libchannel/hub.c +++ b/libchannel/hub.c @@ -43,7 +43,7 @@ channel_alloc_hub (const struct channel_class *class, if (flags & CHANNEL_HARD_WRITEONLY) flags |= CHANNEL_WRITEONLY; - mutex_init (&new->lock); + pthread_mutex_init (&new->lock, NULL); new->name = 0; new->flags = flags; new->hook = 0; @@ -73,7 +73,7 @@ channel_free_hub (struct channel_hub *hub) if (hub->class->clear_hub) (*hub->class->clear_hub) (hub); - mutex_clear (&hub->lock); + pthread_mutex_destroy (&hub->lock); free (hub->name); for (i = 0; i < hub->num_children; i++) |