Re: [gtk-vnc-devel] [patch] yeild conflict with /usr/include/unistd.h on Solaris
- From: "Daniel P. Berrange" <berrange redhat com>
- To: Halton Huo <Halton Huo Sun COM>
- Cc: gtk-vnc-devel lists sourceforge net
- Subject: Re: [gtk-vnc-devel] [patch] yeild conflict with /usr/include/unistd.h on Solaris
- Date: Fri, 26 Oct 2007 14:29:36 +0100
On Fri, Oct 26, 2007 at 03:54:40PM +0800, Halton Huo wrote:
> Hi there,
>
> Hope you've seen my previous three patches, this is the last one I have
> by now. :)
>
> This time is very simple, there is already a function called yeild on
> in /usr/include/unistd.h,
> $cat /usr/include/unistd.h|grep yield
> extern void yield(void);
> extern void yield();
>
> They are different with yeild defined in coroutine.h
> $cat src/coroutine.h|grep yield
> void *yieldto(struct coroutine *to, void *arg);
> void *yield(void *arg);
Yep, this is a problem. I think it is best to rename to coroutine_yield
since that is consistent with the rest of the coroutine APIs. Anthony,
any objections to me applying the patch I'm attaching...
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
diff -r 5e8bee847ab1 src/coroutine.c
--- a/src/coroutine.c Fri Oct 26 09:23:28 2007 -0400
+++ b/src/coroutine.c Fri Oct 26 09:23:59 2007 -0400
@@ -92,7 +92,7 @@ void *coroutine_swap(struct coroutine *f
return NULL;
}
-void *yieldto(struct coroutine *to, void *arg)
+void *coroutine_yieldto(struct coroutine *to, void *arg)
{
if (to->caller) {
fprintf(stderr, "Co-routine is re-entering itself\n");
@@ -102,7 +102,7 @@ void *yieldto(struct coroutine *to, void
return coroutine_swap(coroutine_self(), to, arg);
}
-void *yield(void *arg)
+void *coroutine_yield(void *arg)
{
struct coroutine *to = coroutine_self()->caller;
if (!to) {
diff -r 5e8bee847ab1 src/coroutine.h
--- a/src/coroutine.h Fri Oct 26 09:23:28 2007 -0400
+++ b/src/coroutine.h Fri Oct 26 09:24:11 2007 -0400
@@ -37,9 +37,9 @@ void *coroutine_swap(struct coroutine *f
struct coroutine *coroutine_self(void);
-void *yieldto(struct coroutine *to, void *arg);
+void *coroutine_yieldto(struct coroutine *to, void *arg);
-void *yield(void *arg);
+void *coroutine_yield(void *arg);
#endif
/*
diff -r 5e8bee847ab1 src/gvnc.c
--- a/src/gvnc.c Fri Oct 26 09:23:28 2007 -0400
+++ b/src/gvnc.c Fri Oct 26 09:25:00 2007 -0400
@@ -135,7 +135,7 @@ static gboolean g_io_wait_helper(GIOChan
gpointer data)
{
struct coroutine *to = data;
- yieldto(to, &cond);
+ coroutine_yieldto(to, &cond);
return FALSE;
}
@@ -144,7 +144,7 @@ static GIOCondition g_io_wait(GIOChannel
GIOCondition *ret;
g_io_add_watch(channel, cond | G_IO_HUP | G_IO_ERR | G_IO_NVAL, g_io_wait_helper, coroutine_self());
- ret = yield(NULL);
+ ret = coroutine_yield(NULL);
return *ret;
}
@@ -161,7 +161,7 @@ static GIOCondition g_io_wait_interrupta
id = g_io_add_watch(channel, cond | G_IO_HUP | G_IO_ERR | G_IO_NVAL, g_io_wait_helper, wait->context);
wait->waiting = TRUE;
- ret = yield(NULL);
+ ret = coroutine_yield(NULL);
wait->waiting = FALSE;
if (ret == NULL) {
@@ -174,7 +174,7 @@ static void g_io_wakeup(struct wait_queu
static void g_io_wakeup(struct wait_queue *wait)
{
if (wait->waiting)
- yieldto(wait->context, NULL);
+ coroutine_yieldto(wait->context, NULL);
}
@@ -213,7 +213,7 @@ static gboolean g_condition_wait_helper(
static gboolean g_condition_wait_helper(gpointer data)
{
struct coroutine *co = (struct coroutine *)data;
- yieldto(co, NULL);
+ coroutine_yieldto(co, NULL);
return FALSE;
}
@@ -240,7 +240,7 @@ static gboolean g_condition_wait(g_condi
g_source_attach(src, NULL);
g_source_set_callback(src, g_condition_wait_helper, coroutine_self(), NULL);
- yield(NULL);
+ coroutine_yield(NULL);
return TRUE;
}
diff -r 5e8bee847ab1 src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version Fri Oct 26 09:23:28 2007 -0400
+++ b/src/libgtk-vnc_sym.version Fri Oct 26 09:25:50 2007 -0400
@@ -58,8 +58,8 @@
coroutine_release;
coroutine_swap;
coroutine_self;
- yieldto;
- yield;
+ coroutine_yieldto;
+ coroutine_yield;
local:
*;
diff -r 5e8bee847ab1 src/vncdisplay.c
--- a/src/vncdisplay.c Fri Oct 26 09:23:28 2007 -0400
+++ b/src/vncdisplay.c Fri Oct 26 09:25:13 2007 -0400
@@ -772,7 +772,7 @@ static gboolean do_vnc_display_open(gpoi
co->release = NULL;
coroutine_init(co);
- yieldto(co, obj);
+ coroutine_yieldto(co, obj);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]