[System.Threading.Tasks.Dataflow] Replace implementation with CoreFx version
[mono.git] / mono / utils / mono-threads-posix-abort-syscall.c
1 /*
2  * mono-threads-posix-abort-syscall.c: Low-level syscall aborting
3  *
4  * Author:
5  *      Ludovic Henry (ludovic@xamarin.com)
6  *
7  * (C) 2015 Xamarin, Inc
8  */
9
10 #include "config.h"
11 #include <glib.h>
12
13 #if defined (__MACH__)
14 #define _DARWIN_C_SOURCE 1
15 #endif
16
17 #include "mono-threads.h"
18 #include "mono-threads-posix-signals.h"
19
20 #if defined(USE_POSIX_BACKEND)
21
22 void
23 mono_threads_init_abort_syscall (void)
24 {
25         mono_threads_posix_init_signals (MONO_THREADS_POSIX_INIT_SIGNALS_ABORT);
26 }
27
28 void
29 mono_threads_core_abort_syscall (MonoThreadInfo *info)
30 {
31         /* We signal a thread to break it from the current syscall.
32          * This signal should not be interpreted as a suspend request. */
33         info->syscall_break_signal = TRUE;
34         if (!mono_threads_pthread_kill (info, mono_threads_posix_get_abort_signal ()))
35                 mono_threads_add_to_pending_operation_set (info);
36 }
37
38 gboolean
39 mono_threads_core_needs_abort_syscall (void)
40 {
41         return TRUE;
42 }
43
44 #endif