* thread.c (rb_fd_copy): Change function argument. Now
rb_fd_copy() has fully copy semantics. * include/ruby/intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d2544c8e6
commit
225fa965bc
@ -1,3 +1,9 @@
|
|||||||
|
Sat Apr 30 20:16:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* thread.c (rb_fd_copy): Change function argument. Now
|
||||||
|
rb_fd_copy() has fully copy semantics.
|
||||||
|
* include/ruby/intern.h: ditto.
|
||||||
|
|
||||||
Sat Apr 30 20:11:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Sat Apr 30 20:11:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* include/ruby/intern.h (rb_thread_select): mark as deprecated.
|
* include/ruby/intern.h (rb_thread_select): mark as deprecated.
|
||||||
|
@ -250,7 +250,7 @@ void rb_fd_zero(rb_fdset_t *);
|
|||||||
void rb_fd_set(int, rb_fdset_t *);
|
void rb_fd_set(int, rb_fdset_t *);
|
||||||
void rb_fd_clr(int, rb_fdset_t *);
|
void rb_fd_clr(int, rb_fdset_t *);
|
||||||
int rb_fd_isset(int, const rb_fdset_t *);
|
int rb_fd_isset(int, const rb_fdset_t *);
|
||||||
void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
|
void rb_fd_copy(rb_fdset_t *dst, const rb_fdset_t *src);
|
||||||
int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
|
int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
|
||||||
|
|
||||||
#define rb_fd_ptr(f) ((f)->fdset)
|
#define rb_fd_ptr(f) ((f)->fdset)
|
||||||
@ -269,6 +269,7 @@ void rb_fd_term(rb_fdset_t *);
|
|||||||
void rb_fd_set(int, rb_fdset_t *);
|
void rb_fd_set(int, rb_fdset_t *);
|
||||||
#define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
|
#define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
|
||||||
#define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
|
#define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
|
||||||
|
#define rb_fd_copy(d, s) *((d)->fdset) = *((s)->fdset)
|
||||||
#define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select((n), (rfds) ? ((rb_fdset_t*)(rfds))->fdset : NULL, (wfds) ? ((rb_fdset_t*)(wfds))->fdset : NULL, (efds) ? ((rb_fdset_t*)(efds))->fdset: NULL, (timeout))
|
#define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select((n), (rfds) ? ((rb_fdset_t*)(rfds))->fdset : NULL, (wfds) ? ((rb_fdset_t*)(wfds))->fdset : NULL, (efds) ? ((rb_fdset_t*)(efds))->fdset: NULL, (timeout))
|
||||||
#define rb_fd_resize(n, f) ((void)(f))
|
#define rb_fd_resize(n, f) ((void)(f))
|
||||||
|
|
||||||
@ -282,7 +283,7 @@ typedef fd_set rb_fdset_t;
|
|||||||
#define rb_fd_set(n, f) FD_SET((n), (f))
|
#define rb_fd_set(n, f) FD_SET((n), (f))
|
||||||
#define rb_fd_clr(n, f) FD_CLR((n), (f))
|
#define rb_fd_clr(n, f) FD_CLR((n), (f))
|
||||||
#define rb_fd_isset(n, f) FD_ISSET((n), (f))
|
#define rb_fd_isset(n, f) FD_ISSET((n), (f))
|
||||||
#define rb_fd_copy(d, s, n) (*(d) = *(s))
|
#define rb_fd_copy(d, s) (*(d) = *(s))
|
||||||
#define rb_fd_resize(n, f) ((void)(f))
|
#define rb_fd_resize(n, f) ((void)(f))
|
||||||
#define rb_fd_ptr(f) (f)
|
#define rb_fd_ptr(f) (f)
|
||||||
#define rb_fd_init(f) FD_ZERO(f)
|
#define rb_fd_init(f) FD_ZERO(f)
|
||||||
|
9
thread.c
9
thread.c
@ -2381,12 +2381,13 @@ rb_fd_isset(int n, const rb_fdset_t *fds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
|
rb_fd_copy(rb_fdset_t *dst, const rb_fdset_t *src)
|
||||||
{
|
{
|
||||||
size_t size = howmany(max, NFDBITS) * sizeof(fd_mask);
|
size_t size = howmany(rb_fd_max(src), NFDBITS) * sizeof(fd_mask);
|
||||||
|
|
||||||
if (size < sizeof(fd_set)) size = sizeof(fd_set);
|
if (size < sizeof(fd_set))
|
||||||
dst->maxfd = max;
|
size = sizeof(fd_set);
|
||||||
|
dst->maxfd = src->maxfd;
|
||||||
dst->fdset = xrealloc(dst->fdset, size);
|
dst->fdset = xrealloc(dst->fdset, size);
|
||||||
memcpy(dst->fdset, src, size);
|
memcpy(dst->fdset, src, size);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user