xref: /plan9/sys/src/cmd/gs/src/gp_mspol.c (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2001 artofcode LLC.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gp_mspol.c,v 1.5 2004/08/05 17:02:36 stefan Exp $ */
18 /*
19  * Microsoft Windows platform polling support for Ghostscript.
20  *
21  */
22 
23 #include "gx.h"
24 #include "gp.h"
25 #include "gpcheck.h"
26 #include "iapi.h"
27 #include "iref.h"
28 #include "iminst.h"
29 #include "imain.h"
30 
31 /* ------ Process message loop ------ */
32 /*
33  * Check messages and interrupts; return true if interrupted.
34  * This is called frequently - it must be quick!
35  */
36 #ifdef CHECK_INTERRUPTS
37 int
gp_check_interrupts(const gs_memory_t * mem)38 gp_check_interrupts(const gs_memory_t *mem)
39 {
40     if(mem == NULL) {
41 	/* MAJOR HACK will NOT work in multithreaded environment */
42 	mem = gs_lib_ctx_get_non_gc_memory_t();
43     }
44     if (mem && mem->gs_lib_ctx && mem->gs_lib_ctx->poll_fn)
45 	return (*mem->gs_lib_ctx->poll_fn)(mem->gs_lib_ctx->caller_handle);
46     return 0;
47 }
48 #endif
49