comparison src/alloc.c @ 611:38db05db9cb5

[xemacs-hg @ 2001-06-08 12:21:09 by ben] ------ gc-in-window-procedure fixes ------ alloc.c: Create "post-gc actions", to avoid those dreaded "GC during window procedure" problems. event-msw.c: Abort, clean and simple, when GC in window procedure. We want to flush these puppies out. glyphs-msw.c: Use a post-gc action when destroying subwindows. lisp.h: Declare register_post_gc_action(). scrollbar-msw.c: Use a post-gc action when unshowing scrollbar windows, if in gc. redisplay.c: Add comment about the utter evilness of what's going down here. ------ cygwin setitimer fixes ------ Makefile.in.in: Compile profile.c only when HAVE_SETITIMER. nt.c: Style fixes. nt.c: Move setitimer() emulation to win32.c, because Cygwin needs it too. profile.c: Make sure we don't compile if no setitimer(). Use qxe_setitimer() instead of just plain setitimer(). signal.c: Define qxe_setitimer() as an encapsulation around setitimer() -- call setitimer() directly unless Cygwin or MS Win, in which case we use our simulated version in win32.c. systime.h: Prototype mswindows_setitimer() and qxe_setitimer(). Long comment about "qxe" and the policy regarding encapsulation. win32.c: Move setitimer() emulation here, so Cygwin can use it. Rename a couple of functions and variables to be longer and more descriptive. In setitimer_helper_proc(), send the signal using either mswindows_raise() or (on Cygwin) kill(). If for some reason we are still getting lockups, we'll change the kill() to directly invoke the signal handlers. ------ windows shell fixes ------ callproc.c, ntproc.c: Comments about how these two files must die. callproc.c: On MS Windows, init shell-file-name from SHELL, then COMSPEC, not just COMSPEC. (more correct and closer to FSF.) Don't force a value for SHELL into the environment. (Comments added to explain why not.) nt.c: Don't shove a fabricated SHELL into the environment. See above. ------ misc fixes ------ glyphs-shared.c: Style correction. xemacs-faq.texi: Merge in the rest of Hrvoje's Windows FAQ. Redo section 7 to update current reality and add condensed versions of new changes for 21.1 and 21.4. (Not quite done for 21.4.) Lots more Windows updates. process.el: Need to quote a null argument, too. From Dan Holmsand. startup.el: startup.el: Call MS Windows init function. win32-native.el: Correct comments at top. Correctly handle passing arguments to Cygwin programs and to bash. Fix quoting of zero-length arguments (from Dan Holmsand). Set shell-command-switch based on shell-file-name, which in turn comes from env var SHELL.
author ben
date Fri, 08 Jun 2001 12:21:27 +0000
parents 5fd7ba8b56e7
children af57a77cbc92
comparison
equal deleted inserted replaced
610:45ba69404a1f 611:38db05db9cb5
3238 } 3238 }
3239 3239
3240 /* Maybe we want to use this when doing a "panic" gc after memory_full()? */ 3240 /* Maybe we want to use this when doing a "panic" gc after memory_full()? */
3241 static int gc_hooks_inhibited; 3241 static int gc_hooks_inhibited;
3242 3242
3243 struct post_gc_action
3244 {
3245 void (*fun) (void *);
3246 void *arg;
3247 };
3248
3249 typedef struct post_gc_action post_gc_action;
3250
3251 typedef struct
3252 {
3253 Dynarr_declare (post_gc_action);
3254 } post_gc_action_dynarr;
3255
3256 static post_gc_action_dynarr *post_gc_actions;
3257
3258 /* Register an action to be called at the end of GC.
3259 gc_in_progress is 0 when this is called.
3260 This is used when it is discovered that an action needs to be taken,
3261 but it's during GC, so it's not safe. (e.g. in a finalize method.)
3262
3263 As a general rule, do not use Lisp objects here.
3264 And NEVER signal an error.
3265 */
3266
3267 void
3268 register_post_gc_action (void (*fun) (void *), void *arg)
3269 {
3270 post_gc_action action;
3271
3272 if (!post_gc_actions)
3273 post_gc_actions = Dynarr_new (post_gc_action);
3274
3275 action.fun = fun;
3276 action.arg = arg;
3277
3278 Dynarr_add (post_gc_actions, action);
3279 }
3280
3281 static void
3282 run_post_gc_actions (void)
3283 {
3284 int i;
3285
3286 if (post_gc_actions)
3287 {
3288 for (i = 0; i < Dynarr_length (post_gc_actions); i++)
3289 {
3290 post_gc_action action = Dynarr_at (post_gc_actions, i);
3291 (action.fun) (action.arg);
3292 }
3293
3294 Dynarr_reset (post_gc_actions);
3295 }
3296 }
3297
3243 3298
3244 void 3299 void
3245 garbage_collect_1 (void) 3300 garbage_collect_1 (void)
3246 { 3301 {
3247 #if MAX_SAVE_STACK > 0 3302 #if MAX_SAVE_STACK > 0
3452 if (gc_cons_threshold < 10000) 3507 if (gc_cons_threshold < 10000)
3453 gc_cons_threshold = 10000; 3508 gc_cons_threshold = 10000;
3454 #endif 3509 #endif
3455 3510
3456 gc_in_progress = 0; 3511 gc_in_progress = 0;
3512
3513 run_post_gc_actions ();
3457 3514
3458 /******* End of garbage collection ********/ 3515 /******* End of garbage collection ********/
3459 3516
3460 run_hook_trapping_errors ("Error in post-gc-hook", Qpost_gc_hook); 3517 run_hook_trapping_errors ("Error in post-gc-hook", Qpost_gc_hook);
3461 3518