mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
workaround. [ruby-core:10259] * win32/win32.c (NtInitialize): call above function. * signal.c (sighandler): need to tell to be interrupted to main context when handler is installed. * win32/win32.[ch] (rb_win32_interrupted): new function to listen interrupt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@11855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e1d6f5b48
commit
0533885ae2
4 changed files with 53 additions and 2 deletions
13
ChangeLog
13
ChangeLog
|
|
@ -1,3 +1,16 @@
|
|||
Sat Feb 24 16:53:09 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* signal.c (sighandler): need to tell to be interrupted to main
|
||||
context when handler is installed.
|
||||
|
||||
* win32/win32.[ch] (rb_win32_interrupted): new function to listen
|
||||
interrupt.
|
||||
|
||||
* win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
|
||||
workaround. [ruby-core:10259]
|
||||
|
||||
* win32/win32.c (NtInitialize): call above function.
|
||||
|
||||
Fri Feb 23 13:04:43 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.
|
||||
|
|
|
|||
3
signal.c
3
signal.c
|
|
@ -493,6 +493,9 @@ sighandler(sig)
|
|||
else {
|
||||
ATOMIC_INC(rb_trap_pending);
|
||||
ATOMIC_INC(trap_pending_list[sig]);
|
||||
#ifdef _WIN32
|
||||
rb_w32_interrupted();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -395,7 +395,10 @@ NtInitialize(int *argc, char ***argv)
|
|||
int ret;
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
static void set_pioinfo_extra(void);
|
||||
|
||||
_set_invalid_parameter_handler(invalid_parameter);
|
||||
set_pioinfo_extra();
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
@ -1683,11 +1686,36 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[];
|
|||
|
||||
#define IOINFO_L2E 5
|
||||
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
|
||||
#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1)))
|
||||
#define _pioinfo(i) ((ioinfo*)((char*)(__pioinfo[i >> IOINFO_L2E]) + (i & (IOINFO_ARRAY_ELTS - 1)) * (sizeof(ioinfo) + pioinfo_extra)))
|
||||
#define _osfhnd(i) (_pioinfo(i)->osfhnd)
|
||||
#define _osfile(i) (_pioinfo(i)->osfile)
|
||||
#define _pipech(i) (_pioinfo(i)->pipech)
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
|
||||
|
||||
static void
|
||||
set_pioinfo_extra(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open("NUL", O_RDONLY);
|
||||
for (pioinfo_extra = 0; pioinfo_extra <= 64; pioinfo_extra += sizeof(void *)) {
|
||||
if (_osfhnd(fd) == _get_osfhandle(fd)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (pioinfo_extra > 64) {
|
||||
/* not found, maybe something wrong... */
|
||||
pioinfo_extra = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define pioinfo_extra 0
|
||||
#endif
|
||||
|
||||
#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh)
|
||||
#define _set_osflags(fh, flags) (_osfile(fh) = (flags))
|
||||
|
||||
|
|
@ -3323,6 +3351,12 @@ setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
rb_w32_interrupted(void)
|
||||
{
|
||||
SetSignal(interrupted_event);
|
||||
}
|
||||
|
||||
int
|
||||
rb_w32_main_context(int arg, void (*handler)(int))
|
||||
{
|
||||
|
|
@ -3334,7 +3368,7 @@ rb_w32_main_context(int arg, void (*handler)(int))
|
|||
|
||||
if (GetCurrentThreadId() == main_thread.id) return FALSE;
|
||||
|
||||
SetSignal(interrupted_event);
|
||||
rb_w32_interrupted();
|
||||
|
||||
RUBY_CRITICAL({ /* the main thread must be in user state */
|
||||
CONTEXT ctx;
|
||||
|
|
|
|||
|
|
@ -531,6 +531,7 @@ int rb_w32_times(struct tms *);
|
|||
|
||||
/* thread stuff */
|
||||
HANDLE GetCurrentThreadHandle(void);
|
||||
void rb_w32_interrupted(void);
|
||||
int rb_w32_main_context(int arg, void (*handler)(int));
|
||||
int rb_w32_sleep(unsigned long msec);
|
||||
void rb_w32_enter_critical(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue