diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 06:01:27 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 06:01:27 +0000 |
commit | 66a133bfe80d2ab4156c4026669bda2cf73ec0c7 (patch) | |
tree | 7d40ea09a03f835f95092ac120d9da2db544b0a1 /libgo/runtime/go-rec-small.c | |
parent | d022fa241834e3c570a3bb0248e9ad67bfba3f75 (diff) | |
download | gcc-66a133bfe80d2ab4156c4026669bda2cf73ec0c7.tar.gz |
Tuple receives indicate whether channel is closed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/go-rec-small.c')
-rw-r--r-- | libgo/runtime/go-rec-small.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libgo/runtime/go-rec-small.c b/libgo/runtime/go-rec-small.c index c4dc8b6e892..87aed3cd552 100644 --- a/libgo/runtime/go-rec-small.c +++ b/libgo/runtime/go-rec-small.c @@ -263,7 +263,8 @@ __go_unlock_and_notify_selects (struct __go_channel *channel) /* Receive something 64 bits or smaller on a channel. */ uint64_t -__go_receive_small (struct __go_channel *channel, _Bool for_select) +__go_receive_small_closed (struct __go_channel *channel, _Bool for_select, + _Bool *received) { uint64_t ret; @@ -273,11 +274,26 @@ __go_receive_small (struct __go_channel *channel, _Bool for_select) __go_assert (channel->element_size <= sizeof (uint64_t)); if (!__go_receive_acquire (channel, for_select)) - return 0; + { + if (received != NULL) + *received = 0; + return 0; + } ret = channel->data[channel->next_fetch]; __go_receive_release (channel); + if (received != NULL) + *received = 1; + return ret; } + +/* Called by the compiler. */ + +uint64_t +__go_receive_small (struct __go_channel *channel, _Bool for_select) +{ + return __go_receive_small_closed (channel, for_select, NULL); +} |