mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread problems
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
133ff3421a
commit
35e731649d
7 changed files with 62 additions and 23 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed May 17 14:14:23 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* re.c (rb_reg_new_1): use /m instead of /p.
|
||||
|
||||
Wed May 17 02:22:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (rb_thread_polling): wait 0.06 second to let other
|
||||
|
|
7
eval.c
7
eval.c
|
@ -6736,9 +6736,9 @@ rb_thread_schedule()
|
|||
copy_fds(&readfds, &th->readfds, th->fd);
|
||||
copy_fds(&writefds, &th->writefds, th->fd);
|
||||
copy_fds(&exceptfds, &th->exceptfds, th->fd);
|
||||
th->fd = 0;
|
||||
if (max < th->fd) max = th->fd;
|
||||
need_select = 1;
|
||||
th->fd = 0;
|
||||
}
|
||||
if (th->wait_for & WAIT_TIME) {
|
||||
if (th->delay <= now) {
|
||||
|
@ -6885,8 +6885,9 @@ rb_thread_fd_writable(fd)
|
|||
curr_thread->status = THREAD_STOPPED;
|
||||
FD_ZERO(&curr_thread->readfds);
|
||||
FD_ZERO(&curr_thread->writefds);
|
||||
FD_ZERO(&curr_thread->exceptfds);
|
||||
FD_SET(fd, &curr_thread->writefds);
|
||||
FD_ZERO(&curr_thread->exceptfds);
|
||||
curr_thread->fd = fd+1;
|
||||
curr_thread->wait_for = WAIT_SELECT;
|
||||
rb_thread_schedule();
|
||||
}
|
||||
|
@ -7011,7 +7012,7 @@ rb_thread_select(max, read, write, except, timeout)
|
|||
if (timeout) {
|
||||
curr_thread->delay = timeofday() +
|
||||
(double)timeout->tv_sec + (double)timeout->tv_usec*1e-6;
|
||||
curr_thread->wait_for = WAIT_TIME;
|
||||
curr_thread->wait_for |= WAIT_TIME;
|
||||
}
|
||||
rb_thread_schedule();
|
||||
if (read) *read = curr_thread->readfds;
|
||||
|
|
|
@ -621,17 +621,6 @@ ipaddr(sockaddr)
|
|||
return ary;
|
||||
}
|
||||
|
||||
static void
|
||||
thread_write_select(fd)
|
||||
int fd;
|
||||
{
|
||||
fd_set fds;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
rb_thread_select(fd+1, 0, &fds, 0, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
ruby_socket(domain, type, proto)
|
||||
int domain, type, proto;
|
||||
|
@ -692,7 +681,7 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||
#ifdef EINPROGRESS
|
||||
case EINPROGRESS:
|
||||
#endif
|
||||
thread_write_select(fd);
|
||||
rb_thread_fd_writable(fd);
|
||||
continue;
|
||||
|
||||
#ifdef EISCONN
|
||||
|
|
5
parse.y
5
parse.y
|
@ -2256,8 +2256,9 @@ parse_regx(term, paren)
|
|||
case 'x':
|
||||
options |= RE_OPTION_EXTENDED;
|
||||
break;
|
||||
case 'p':
|
||||
options |= RE_OPTION_POSIXLINE;
|
||||
case 'p': /* /p is obsolete, works as /m */
|
||||
case 'm':
|
||||
options |= RE_OPTION_MULTILINE;
|
||||
break;
|
||||
case 'o':
|
||||
once = 1;
|
||||
|
|
12
re.c
12
re.c
|
@ -91,6 +91,7 @@ rb_str_cicmp(str1, str2)
|
|||
#define REG_IGNORECASE FL_USER1
|
||||
#define REG_EXTENDED FL_USER2
|
||||
#define REG_POSIXLINE FL_USER3
|
||||
#define REG_MULTILINE FL_USER3
|
||||
|
||||
#define KCODE_NONE 0
|
||||
#define KCODE_EUC FL_USER4
|
||||
|
@ -249,8 +250,8 @@ rb_reg_desc(s, len, re)
|
|||
rb_str_cat2(str, "i");
|
||||
if (FL_TEST(re, REG_EXTENDED))
|
||||
rb_str_cat2(str, "x");
|
||||
if (FL_TEST(re, REG_POSIXLINE))
|
||||
rb_str_cat2(str, "p");
|
||||
if (FL_TEST(re, REG_MULTILINE))
|
||||
rb_str_cat2(str, "m");
|
||||
if (FL_TEST(re, KCODE_FIXED)) {
|
||||
switch ((RBASIC(re)->flags & KCODE_MASK)) {
|
||||
case KCODE_NONE:
|
||||
|
@ -757,7 +758,7 @@ rb_reg_new_1(klass, s, len, options)
|
|||
int len;
|
||||
int options; /* CASEFOLD = 1 */
|
||||
/* EXTENDED = 2 */
|
||||
/* POSIXLINE = 4 */
|
||||
/* MULTILINE = 4 */
|
||||
/* CODE_NONE = 8 */
|
||||
/* CODE_EUC = 16 */
|
||||
/* CODE_SJIS = 24 */
|
||||
|
@ -774,8 +775,8 @@ rb_reg_new_1(klass, s, len, options)
|
|||
if (options & RE_OPTION_EXTENDED) {
|
||||
FL_SET(re, REG_EXTENDED);
|
||||
}
|
||||
if (options & RE_OPTION_POSIXLINE) {
|
||||
FL_SET(re, REG_POSIXLINE);
|
||||
if (options & RE_OPTION_MULTILINE) {
|
||||
FL_SET(re, REG_MULTILINE);
|
||||
}
|
||||
switch (options & ~0x7) {
|
||||
case 0:
|
||||
|
@ -1297,6 +1298,7 @@ Init_Regexp()
|
|||
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE));
|
||||
rb_define_const(rb_cRegexp, "EXTENDED", INT2FIX(RE_OPTION_EXTENDED));
|
||||
rb_define_const(rb_cRegexp, "POSIXLINE", INT2FIX(RE_OPTION_POSIXLINE));
|
||||
rb_define_const(rb_cRegexp, "MULTILINE", INT2FIX(RE_OPTION_MULTILINE));
|
||||
|
||||
rb_global_variable(®_cache);
|
||||
|
||||
|
|
40
regex.c
40
regex.c
|
@ -352,6 +352,8 @@ enum regexpcode
|
|||
casefold_off, /* Turn off casefold flag. */
|
||||
posix_on, /* Turn on POSIXified line match (match with newlines). */
|
||||
posix_off, /* Turn off POSIXified line match. */
|
||||
mline_on, /* Turn on multi line match (match with newlines). */
|
||||
mline_off, /* Turn off multi line match. */
|
||||
start_nowidth, /* Save string point to the stack. */
|
||||
stop_nowidth, /* Restore string place at the point start_nowidth. */
|
||||
pop_and_fail, /* Fail after popping nowidth entry from stack. */
|
||||
|
@ -772,6 +774,14 @@ print_partial_compiled_pattern(start, end)
|
|||
printf("/posix_off");
|
||||
break;
|
||||
|
||||
case mline_on:
|
||||
printf("/mline_on");
|
||||
break;
|
||||
|
||||
case mline_off:
|
||||
printf("/mline_off");
|
||||
break;
|
||||
|
||||
case start_nowidth:
|
||||
EXTRACT_NUMBER_AND_INCR (mcnt, p);
|
||||
printf("/start_nowidth//%d", mcnt);
|
||||
|
@ -1027,6 +1037,8 @@ calculate_must_string(start, end)
|
|||
case stop_paren:
|
||||
case posix_on:
|
||||
case posix_off:
|
||||
case mline_on:
|
||||
case mline_off:
|
||||
break;
|
||||
|
||||
case charset:
|
||||
|
@ -1689,6 +1701,18 @@ re_compile_pattern(pattern, size, bufp)
|
|||
BUFPUSH(posix_on);
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (negative) {
|
||||
if (options&RE_OPTION_MULTILINE) {
|
||||
options &= ~RE_OPTION_MULTILINE;
|
||||
BUFPUSH(mline_off);
|
||||
}
|
||||
}
|
||||
else if (!(options&RE_OPTION_MULTILINE)) {
|
||||
options |= RE_OPTION_MULTILINE;
|
||||
BUFPUSH(mline_on);
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
if (negative) {
|
||||
if (options&RE_OPTION_IGNORECASE) {
|
||||
|
@ -1802,6 +1826,9 @@ re_compile_pattern(pattern, size, bufp)
|
|||
if ((options ^ stackp[-1]) & RE_OPTION_POSIXLINE) {
|
||||
BUFPUSH((options&RE_OPTION_POSIXLINE)?posix_off:posix_on);
|
||||
}
|
||||
if ((options ^ stackp[-1]) & RE_OPTION_MULTILINE) {
|
||||
BUFPUSH((options&RE_OPTION_POSIXLINE)?mline_off:mline_on);
|
||||
}
|
||||
pending_exact = 0;
|
||||
if (fixup_alt_jump) {
|
||||
/* Push a dummy failure point at the end of the
|
||||
|
@ -2765,6 +2792,11 @@ re_compile_fastmap(bufp)
|
|||
options ^= RE_OPTION_POSIXLINE;
|
||||
continue;
|
||||
|
||||
case mline_on:
|
||||
case mline_off:
|
||||
options ^= RE_OPTION_MULTILINE;
|
||||
continue;
|
||||
|
||||
case endline:
|
||||
if (TRANSLATE_P())
|
||||
fastmap[translate['\n']] = 1;
|
||||
|
@ -4105,6 +4137,14 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
options &= ~RE_OPTION_POSIXLINE;
|
||||
continue;
|
||||
|
||||
case mline_on:
|
||||
options |= RE_OPTION_MULTILINE;
|
||||
continue;
|
||||
|
||||
case mline_off:
|
||||
options &= ~RE_OPTION_MULTILINE;
|
||||
continue;
|
||||
|
||||
case wordbound:
|
||||
if (AT_STRINGS_BEG(d)) {
|
||||
if (IS_A_LETTER(d)) break;
|
||||
|
|
4
regex.h
4
regex.h
|
@ -69,8 +69,10 @@
|
|||
#define RE_OPTION_IGNORECASE (1L)
|
||||
/* perl-style extended pattern available */
|
||||
#define RE_OPTION_EXTENDED (RE_OPTION_IGNORECASE<<1)
|
||||
/* newline will be included for . and invert charclass matches */
|
||||
/* newline will be included for ., ^, $ does not handle newline - obsolete */
|
||||
#define RE_OPTION_POSIXLINE (RE_OPTION_EXTENDED<<1)
|
||||
/* newline will be included for . */
|
||||
#define RE_OPTION_MULTILINE (RE_OPTION_POSIXLINE<<1)
|
||||
/* search for longest match, in accord with POSIX regexp */
|
||||
#define RE_OPTION_LONGEST (RE_OPTION_POSIXLINE<<1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue