summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-12 01:25:53 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-12 01:25:53 +0000
commit5a8f3cd8adaabc814a916e225ff4af9c0689ac92 (patch)
treefd143874aff6f0291c08b1b2fd3dd87c49ec36c9
parentbecf233178d2cf402591e97d7a8499cafbbb7251 (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.
-rw-r--r--channelio/Makefile3
-rw-r--r--channelio/open.h4
-rw-r--r--libchannel/broadcast.c8
-rw-r--r--libchannel/channel.h4
-rw-r--r--libchannel/hub.c4
5 files changed, 12 insertions, 11 deletions
diff --git a/channelio/Makefile b/channelio/Makefile
index 457d8d6a8..5c1130f7a 100644
--- a/channelio/Makefile
+++ b/channelio/Makefile
@@ -25,6 +25,7 @@ SRCS = channelio.c io.c node.c open.c
LCLHDRS = node.h open.h
OBJS = $(SRCS:.c=.o)
-HURDLIBS = trivfs fshelp iohelp channel threads ports ihash shouldbeinlibc
+HURDLIBS = trivfs fshelp iohelp channel ports ihash shouldbeinlibc
+OTHERLIBS = -lpthread
include ../Makeconf
diff --git a/channelio/open.h b/channelio/open.h
index 43dc85407..98f1d47c1 100644
--- a/channelio/open.h
+++ b/channelio/open.h
@@ -22,13 +22,13 @@
#ifndef __OPEN_H__
#define __OPEN_H__
-#include <cthreads.h>
+#include <pthread.h>
#include <hurd/channel.h>
/* Information about an open session. */
struct open
{
- struct mutex lock;
+ pthread_mutex_t lock;
struct channel *channel;
/* The current owner of the session. For terminals, this affects
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++)