/src/ghostpdl/base/gp_poll.c
Line | Count | Source |
1 | | /* Copyright (C) 2001-2026 Artifex Software, Inc. |
2 | | All Rights Reserved. |
3 | | |
4 | | This software is provided AS-IS with no warranty, either express or |
5 | | implied. |
6 | | |
7 | | This software is distributed under license and may not be copied, |
8 | | modified or distributed except as expressly authorized under the terms |
9 | | of the license contained in the file LICENSE in this distribution. |
10 | | |
11 | | Refer to licensing information at http://www.artifex.com or contact |
12 | | Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, |
13 | | CA 94129, USA, for further information. |
14 | | */ |
15 | | |
16 | | |
17 | | /* |
18 | | * Platform polling support for Ghostscript. |
19 | | * |
20 | | */ |
21 | | |
22 | | #include "gx.h" |
23 | | #include "gp.h" |
24 | | #include "gpcheck.h" |
25 | | |
26 | | /* ------ Process message loop ------ */ |
27 | | /* |
28 | | * Check messages and interrupts; return true if interrupted. |
29 | | * This is called frequently - it must be quick! |
30 | | */ |
31 | | #ifdef CHECK_INTERRUPTS |
32 | | int |
33 | | gp_check_interrupts(const gs_memory_t *mem) |
34 | 543M | { |
35 | | #ifdef DEBUG |
36 | | if(mem == NULL) { |
37 | | mem = gp_get_debug_mem_ptr(); |
38 | | } |
39 | | #endif |
40 | 543M | if (mem && mem->gs_lib_ctx && mem->gs_lib_ctx->core) |
41 | 543M | { |
42 | 543M | #ifdef GS_HAS_THREADS |
43 | 543M | if (mem->gs_lib_ctx->core->timedout) |
44 | 0 | return 1; |
45 | 543M | #endif |
46 | 543M | if (mem->gs_lib_ctx->core->poll_fn) |
47 | 0 | return (*mem->gs_lib_ctx->core->poll_fn)(mem->gs_lib_ctx->core->poll_caller_handle); |
48 | 543M | } |
49 | 543M | return 0; |
50 | 543M | } |
51 | | #endif |