blob: 6745f45ef75105f3dcb1969b0e4a75135415d964 [file] [log] [blame]
Tal Einatc7027b72015-05-16 14:14:49 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5#if defined(HAVE_ALARM)
6
7PyDoc_STRVAR(signal_alarm__doc__,
8"alarm($module, seconds, /)\n"
9"--\n"
10"\n"
11"Arrange for SIGALRM to arrive after the given number of seconds.");
12
13#define SIGNAL_ALARM_METHODDEF \
14 {"alarm", (PyCFunction)signal_alarm, METH_O, signal_alarm__doc__},
15
16static long
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030017signal_alarm_impl(PyObject *module, int seconds);
Tal Einatc7027b72015-05-16 14:14:49 +030018
19static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030020signal_alarm(PyObject *module, PyObject *arg)
Tal Einatc7027b72015-05-16 14:14:49 +030021{
22 PyObject *return_value = NULL;
23 int seconds;
24 long _return_value;
25
Serhiy Storchaka32d96a22018-12-25 13:23:47 +020026 if (PyFloat_Check(arg)) {
27 PyErr_SetString(PyExc_TypeError,
28 "integer argument expected, got float" );
29 goto exit;
30 }
31 seconds = _PyLong_AsInt(arg);
32 if (seconds == -1 && PyErr_Occurred()) {
Tal Einatc7027b72015-05-16 14:14:49 +030033 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030034 }
Tal Einatc7027b72015-05-16 14:14:49 +030035 _return_value = signal_alarm_impl(module, seconds);
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030036 if ((_return_value == -1) && PyErr_Occurred()) {
Tal Einatc7027b72015-05-16 14:14:49 +030037 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030038 }
Tal Einatc7027b72015-05-16 14:14:49 +030039 return_value = PyLong_FromLong(_return_value);
40
41exit:
42 return return_value;
43}
44
45#endif /* defined(HAVE_ALARM) */
46
47#if defined(HAVE_PAUSE)
48
49PyDoc_STRVAR(signal_pause__doc__,
50"pause($module, /)\n"
51"--\n"
52"\n"
53"Wait until a signal arrives.");
54
55#define SIGNAL_PAUSE_METHODDEF \
56 {"pause", (PyCFunction)signal_pause, METH_NOARGS, signal_pause__doc__},
57
58static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030059signal_pause_impl(PyObject *module);
Tal Einatc7027b72015-05-16 14:14:49 +030060
61static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030062signal_pause(PyObject *module, PyObject *Py_UNUSED(ignored))
Tal Einatc7027b72015-05-16 14:14:49 +030063{
64 return signal_pause_impl(module);
65}
66
67#endif /* defined(HAVE_PAUSE) */
68
69PyDoc_STRVAR(signal_signal__doc__,
70"signal($module, signalnum, handler, /)\n"
71"--\n"
72"\n"
73"Set the action for the given signal.\n"
74"\n"
75"The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
76"The previous action is returned. See getsignal() for possible return values.\n"
77"\n"
78"*** IMPORTANT NOTICE ***\n"
79"A signal handler function is called with two arguments:\n"
80"the first is the signal number, the second is the interrupted stack frame.");
81
82#define SIGNAL_SIGNAL_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +020083 {"signal", (PyCFunction)(void(*)(void))signal_signal, METH_FASTCALL, signal_signal__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +030084
85static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030086signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
Tal Einatc7027b72015-05-16 14:14:49 +030087
88static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +020089signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +030090{
91 PyObject *return_value = NULL;
92 int signalnum;
93 PyObject *handler;
94
Sylvain74453812017-06-10 06:51:48 +020095 if (!_PyArg_ParseStack(args, nargs, "iO:signal",
96 &signalnum, &handler)) {
Victor Stinner259f0e42017-01-17 01:35:17 +010097 goto exit;
98 }
Tal Einatc7027b72015-05-16 14:14:49 +030099 return_value = signal_signal_impl(module, signalnum, handler);
100
101exit:
102 return return_value;
103}
104
105PyDoc_STRVAR(signal_getsignal__doc__,
106"getsignal($module, signalnum, /)\n"
107"--\n"
108"\n"
109"Return the current action for the given signal.\n"
110"\n"
111"The return value can be:\n"
112" SIG_IGN -- if the signal is being ignored\n"
113" SIG_DFL -- if the default action for the signal is in effect\n"
114" None -- if an unknown handler is in effect\n"
115" anything else -- the callable Python object used as a handler");
116
117#define SIGNAL_GETSIGNAL_METHODDEF \
118 {"getsignal", (PyCFunction)signal_getsignal, METH_O, signal_getsignal__doc__},
119
120static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300121signal_getsignal_impl(PyObject *module, int signalnum);
Tal Einatc7027b72015-05-16 14:14:49 +0300122
123static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300124signal_getsignal(PyObject *module, PyObject *arg)
Tal Einatc7027b72015-05-16 14:14:49 +0300125{
126 PyObject *return_value = NULL;
127 int signalnum;
128
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200129 if (PyFloat_Check(arg)) {
130 PyErr_SetString(PyExc_TypeError,
131 "integer argument expected, got float" );
132 goto exit;
133 }
134 signalnum = _PyLong_AsInt(arg);
135 if (signalnum == -1 && PyErr_Occurred()) {
Tal Einatc7027b72015-05-16 14:14:49 +0300136 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300137 }
Tal Einatc7027b72015-05-16 14:14:49 +0300138 return_value = signal_getsignal_impl(module, signalnum);
139
140exit:
141 return return_value;
142}
143
Antoine Pietri5d2a27d2018-03-12 14:42:34 +0100144PyDoc_STRVAR(signal_strsignal__doc__,
145"strsignal($module, signalnum, /)\n"
146"--\n"
147"\n"
148"Return the system description of the given signal.\n"
149"\n"
150"The return values can be such as \"Interrupt\", \"Segmentation fault\", etc.\n"
151"Returns None if the signal is not recognized.");
152
153#define SIGNAL_STRSIGNAL_METHODDEF \
154 {"strsignal", (PyCFunction)signal_strsignal, METH_O, signal_strsignal__doc__},
155
156static PyObject *
157signal_strsignal_impl(PyObject *module, int signalnum);
158
159static PyObject *
160signal_strsignal(PyObject *module, PyObject *arg)
161{
162 PyObject *return_value = NULL;
163 int signalnum;
164
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200165 if (PyFloat_Check(arg)) {
166 PyErr_SetString(PyExc_TypeError,
167 "integer argument expected, got float" );
168 goto exit;
169 }
170 signalnum = _PyLong_AsInt(arg);
171 if (signalnum == -1 && PyErr_Occurred()) {
Antoine Pietri5d2a27d2018-03-12 14:42:34 +0100172 goto exit;
173 }
174 return_value = signal_strsignal_impl(module, signalnum);
175
176exit:
177 return return_value;
178}
179
Tal Einatc7027b72015-05-16 14:14:49 +0300180#if defined(HAVE_SIGINTERRUPT)
181
182PyDoc_STRVAR(signal_siginterrupt__doc__,
183"siginterrupt($module, signalnum, flag, /)\n"
184"--\n"
185"\n"
186"Change system call restart behaviour.\n"
187"\n"
188"If flag is False, system calls will be restarted when interrupted by\n"
189"signal sig, else system calls will be interrupted.");
190
191#define SIGNAL_SIGINTERRUPT_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200192 {"siginterrupt", (PyCFunction)(void(*)(void))signal_siginterrupt, METH_FASTCALL, signal_siginterrupt__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +0300193
194static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300195signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
Tal Einatc7027b72015-05-16 14:14:49 +0300196
197static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200198signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +0300199{
200 PyObject *return_value = NULL;
201 int signalnum;
202 int flag;
203
Sylvain74453812017-06-10 06:51:48 +0200204 if (!_PyArg_ParseStack(args, nargs, "ii:siginterrupt",
205 &signalnum, &flag)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100206 goto exit;
207 }
Tal Einatc7027b72015-05-16 14:14:49 +0300208 return_value = signal_siginterrupt_impl(module, signalnum, flag);
209
210exit:
211 return return_value;
212}
213
214#endif /* defined(HAVE_SIGINTERRUPT) */
215
216#if defined(HAVE_SETITIMER)
217
218PyDoc_STRVAR(signal_setitimer__doc__,
219"setitimer($module, which, seconds, interval=0.0, /)\n"
220"--\n"
221"\n"
222"Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
223"\n"
224"The timer will fire after value seconds and after that every interval seconds.\n"
225"The itimer can be cleared by setting seconds to zero.\n"
226"\n"
227"Returns old values as a tuple: (delay, interval).");
228
229#define SIGNAL_SETITIMER_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200230 {"setitimer", (PyCFunction)(void(*)(void))signal_setitimer, METH_FASTCALL, signal_setitimer__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +0300231
232static PyObject *
Victor Stinneref611c92017-10-13 13:49:43 -0700233signal_setitimer_impl(PyObject *module, int which, PyObject *seconds,
234 PyObject *interval);
Tal Einatc7027b72015-05-16 14:14:49 +0300235
236static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200237signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +0300238{
239 PyObject *return_value = NULL;
240 int which;
Victor Stinneref611c92017-10-13 13:49:43 -0700241 PyObject *seconds;
242 PyObject *interval = NULL;
Tal Einatc7027b72015-05-16 14:14:49 +0300243
Victor Stinneref611c92017-10-13 13:49:43 -0700244 if (!_PyArg_ParseStack(args, nargs, "iO|O:setitimer",
Sylvain74453812017-06-10 06:51:48 +0200245 &which, &seconds, &interval)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100246 goto exit;
247 }
Tal Einatc7027b72015-05-16 14:14:49 +0300248 return_value = signal_setitimer_impl(module, which, seconds, interval);
249
250exit:
251 return return_value;
252}
253
254#endif /* defined(HAVE_SETITIMER) */
255
256#if defined(HAVE_GETITIMER)
257
258PyDoc_STRVAR(signal_getitimer__doc__,
259"getitimer($module, which, /)\n"
260"--\n"
261"\n"
262"Returns current value of given itimer.");
263
264#define SIGNAL_GETITIMER_METHODDEF \
265 {"getitimer", (PyCFunction)signal_getitimer, METH_O, signal_getitimer__doc__},
266
267static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300268signal_getitimer_impl(PyObject *module, int which);
Tal Einatc7027b72015-05-16 14:14:49 +0300269
270static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300271signal_getitimer(PyObject *module, PyObject *arg)
Tal Einatc7027b72015-05-16 14:14:49 +0300272{
273 PyObject *return_value = NULL;
274 int which;
275
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200276 if (PyFloat_Check(arg)) {
277 PyErr_SetString(PyExc_TypeError,
278 "integer argument expected, got float" );
279 goto exit;
280 }
281 which = _PyLong_AsInt(arg);
282 if (which == -1 && PyErr_Occurred()) {
Tal Einatc7027b72015-05-16 14:14:49 +0300283 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300284 }
Tal Einatc7027b72015-05-16 14:14:49 +0300285 return_value = signal_getitimer_impl(module, which);
286
287exit:
288 return return_value;
289}
290
291#endif /* defined(HAVE_GETITIMER) */
292
293#if defined(PYPTHREAD_SIGMASK)
294
295PyDoc_STRVAR(signal_pthread_sigmask__doc__,
296"pthread_sigmask($module, how, mask, /)\n"
297"--\n"
298"\n"
299"Fetch and/or change the signal mask of the calling thread.");
300
301#define SIGNAL_PTHREAD_SIGMASK_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200302 {"pthread_sigmask", (PyCFunction)(void(*)(void))signal_pthread_sigmask, METH_FASTCALL, signal_pthread_sigmask__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +0300303
304static PyObject *
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300305signal_pthread_sigmask_impl(PyObject *module, int how, sigset_t mask);
Tal Einatc7027b72015-05-16 14:14:49 +0300306
307static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200308signal_pthread_sigmask(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +0300309{
310 PyObject *return_value = NULL;
311 int how;
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300312 sigset_t mask;
Tal Einatc7027b72015-05-16 14:14:49 +0300313
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300314 if (!_PyArg_ParseStack(args, nargs, "iO&:pthread_sigmask",
315 &how, _Py_Sigset_Converter, &mask)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100316 goto exit;
317 }
Tal Einatc7027b72015-05-16 14:14:49 +0300318 return_value = signal_pthread_sigmask_impl(module, how, mask);
319
320exit:
321 return return_value;
322}
323
324#endif /* defined(PYPTHREAD_SIGMASK) */
325
326#if defined(HAVE_SIGPENDING)
327
328PyDoc_STRVAR(signal_sigpending__doc__,
329"sigpending($module, /)\n"
330"--\n"
331"\n"
332"Examine pending signals.\n"
333"\n"
334"Returns a set of signal numbers that are pending for delivery to\n"
335"the calling thread.");
336
337#define SIGNAL_SIGPENDING_METHODDEF \
338 {"sigpending", (PyCFunction)signal_sigpending, METH_NOARGS, signal_sigpending__doc__},
339
340static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300341signal_sigpending_impl(PyObject *module);
Tal Einatc7027b72015-05-16 14:14:49 +0300342
343static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300344signal_sigpending(PyObject *module, PyObject *Py_UNUSED(ignored))
Tal Einatc7027b72015-05-16 14:14:49 +0300345{
346 return signal_sigpending_impl(module);
347}
348
349#endif /* defined(HAVE_SIGPENDING) */
350
351#if defined(HAVE_SIGWAIT)
352
353PyDoc_STRVAR(signal_sigwait__doc__,
354"sigwait($module, sigset, /)\n"
355"--\n"
356"\n"
357"Wait for a signal.\n"
358"\n"
359"Suspend execution of the calling thread until the delivery of one of the\n"
360"signals specified in the signal set sigset. The function accepts the signal\n"
361"and returns the signal number.");
362
363#define SIGNAL_SIGWAIT_METHODDEF \
364 {"sigwait", (PyCFunction)signal_sigwait, METH_O, signal_sigwait__doc__},
365
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300366static PyObject *
367signal_sigwait_impl(PyObject *module, sigset_t sigset);
368
369static PyObject *
370signal_sigwait(PyObject *module, PyObject *arg)
371{
372 PyObject *return_value = NULL;
373 sigset_t sigset;
374
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200375 if (!_Py_Sigset_Converter(arg, &sigset)) {
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300376 goto exit;
377 }
378 return_value = signal_sigwait_impl(module, sigset);
379
380exit:
381 return return_value;
382}
383
Tal Einatc7027b72015-05-16 14:14:49 +0300384#endif /* defined(HAVE_SIGWAIT) */
385
Antoine Pitrou9d3627e2018-05-04 13:00:50 +0200386#if (defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS))
387
388PyDoc_STRVAR(signal_valid_signals__doc__,
389"valid_signals($module, /)\n"
390"--\n"
391"\n"
392"Return a set of valid signal numbers on this platform.\n"
393"\n"
394"The signal numbers returned by this function can be safely passed to\n"
395"functions like `pthread_sigmask`.");
396
397#define SIGNAL_VALID_SIGNALS_METHODDEF \
398 {"valid_signals", (PyCFunction)signal_valid_signals, METH_NOARGS, signal_valid_signals__doc__},
399
400static PyObject *
401signal_valid_signals_impl(PyObject *module);
402
403static PyObject *
404signal_valid_signals(PyObject *module, PyObject *Py_UNUSED(ignored))
405{
406 return signal_valid_signals_impl(module);
407}
408
409#endif /* (defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS)) */
410
Tal Einatc7027b72015-05-16 14:14:49 +0300411#if defined(HAVE_SIGWAITINFO)
412
413PyDoc_STRVAR(signal_sigwaitinfo__doc__,
414"sigwaitinfo($module, sigset, /)\n"
415"--\n"
416"\n"
417"Wait synchronously until one of the signals in *sigset* is delivered.\n"
418"\n"
419"Returns a struct_siginfo containing information about the signal.");
420
421#define SIGNAL_SIGWAITINFO_METHODDEF \
422 {"sigwaitinfo", (PyCFunction)signal_sigwaitinfo, METH_O, signal_sigwaitinfo__doc__},
423
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300424static PyObject *
425signal_sigwaitinfo_impl(PyObject *module, sigset_t sigset);
426
427static PyObject *
428signal_sigwaitinfo(PyObject *module, PyObject *arg)
429{
430 PyObject *return_value = NULL;
431 sigset_t sigset;
432
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200433 if (!_Py_Sigset_Converter(arg, &sigset)) {
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300434 goto exit;
435 }
436 return_value = signal_sigwaitinfo_impl(module, sigset);
437
438exit:
439 return return_value;
440}
441
Tal Einatc7027b72015-05-16 14:14:49 +0300442#endif /* defined(HAVE_SIGWAITINFO) */
443
444#if defined(HAVE_SIGTIMEDWAIT)
445
446PyDoc_STRVAR(signal_sigtimedwait__doc__,
447"sigtimedwait($module, sigset, timeout, /)\n"
448"--\n"
449"\n"
450"Like sigwaitinfo(), but with a timeout.\n"
451"\n"
452"The timeout is specified in seconds, with floating point numbers allowed.");
453
454#define SIGNAL_SIGTIMEDWAIT_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200455 {"sigtimedwait", (PyCFunction)(void(*)(void))signal_sigtimedwait, METH_FASTCALL, signal_sigtimedwait__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +0300456
457static PyObject *
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300458signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
Serhiy Storchaka6b680cd2015-05-16 15:57:56 +0300459 PyObject *timeout_obj);
Tal Einatc7027b72015-05-16 14:14:49 +0300460
461static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200462signal_sigtimedwait(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +0300463{
464 PyObject *return_value = NULL;
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300465 sigset_t sigset;
Serhiy Storchaka6b680cd2015-05-16 15:57:56 +0300466 PyObject *timeout_obj;
Tal Einatc7027b72015-05-16 14:14:49 +0300467
Serhiy Storchakad54cfb12018-05-08 07:48:50 +0300468 if (!_PyArg_ParseStack(args, nargs, "O&O:sigtimedwait",
469 _Py_Sigset_Converter, &sigset, &timeout_obj)) {
Victor Stinner0c4a8282017-01-17 02:21:47 +0100470 goto exit;
471 }
Serhiy Storchaka6b680cd2015-05-16 15:57:56 +0300472 return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
Tal Einatc7027b72015-05-16 14:14:49 +0300473
474exit:
475 return return_value;
476}
477
478#endif /* defined(HAVE_SIGTIMEDWAIT) */
479
Antoine Pitroua6a4dc82017-09-07 18:56:24 +0200480#if defined(HAVE_PTHREAD_KILL)
Tal Einatc7027b72015-05-16 14:14:49 +0300481
482PyDoc_STRVAR(signal_pthread_kill__doc__,
483"pthread_kill($module, thread_id, signalnum, /)\n"
484"--\n"
485"\n"
486"Send a signal to a thread.");
487
488#define SIGNAL_PTHREAD_KILL_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200489 {"pthread_kill", (PyCFunction)(void(*)(void))signal_pthread_kill, METH_FASTCALL, signal_pthread_kill__doc__},
Tal Einatc7027b72015-05-16 14:14:49 +0300490
491static PyObject *
Serhiy Storchakaaefa7eb2017-03-23 15:48:39 +0200492signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
493 int signalnum);
Tal Einatc7027b72015-05-16 14:14:49 +0300494
495static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200496signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Tal Einatc7027b72015-05-16 14:14:49 +0300497{
498 PyObject *return_value = NULL;
Serhiy Storchakaaefa7eb2017-03-23 15:48:39 +0200499 unsigned long thread_id;
Tal Einatc7027b72015-05-16 14:14:49 +0300500 int signalnum;
501
Sylvain74453812017-06-10 06:51:48 +0200502 if (!_PyArg_ParseStack(args, nargs, "ki:pthread_kill",
503 &thread_id, &signalnum)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100504 goto exit;
505 }
Tal Einatc7027b72015-05-16 14:14:49 +0300506 return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
507
508exit:
509 return return_value;
510}
511
Antoine Pitroua6a4dc82017-09-07 18:56:24 +0200512#endif /* defined(HAVE_PTHREAD_KILL) */
Tal Einatc7027b72015-05-16 14:14:49 +0300513
514#ifndef SIGNAL_ALARM_METHODDEF
515 #define SIGNAL_ALARM_METHODDEF
516#endif /* !defined(SIGNAL_ALARM_METHODDEF) */
517
518#ifndef SIGNAL_PAUSE_METHODDEF
519 #define SIGNAL_PAUSE_METHODDEF
520#endif /* !defined(SIGNAL_PAUSE_METHODDEF) */
521
522#ifndef SIGNAL_SIGINTERRUPT_METHODDEF
523 #define SIGNAL_SIGINTERRUPT_METHODDEF
524#endif /* !defined(SIGNAL_SIGINTERRUPT_METHODDEF) */
525
526#ifndef SIGNAL_SETITIMER_METHODDEF
527 #define SIGNAL_SETITIMER_METHODDEF
528#endif /* !defined(SIGNAL_SETITIMER_METHODDEF) */
529
530#ifndef SIGNAL_GETITIMER_METHODDEF
531 #define SIGNAL_GETITIMER_METHODDEF
532#endif /* !defined(SIGNAL_GETITIMER_METHODDEF) */
533
534#ifndef SIGNAL_PTHREAD_SIGMASK_METHODDEF
535 #define SIGNAL_PTHREAD_SIGMASK_METHODDEF
536#endif /* !defined(SIGNAL_PTHREAD_SIGMASK_METHODDEF) */
537
538#ifndef SIGNAL_SIGPENDING_METHODDEF
539 #define SIGNAL_SIGPENDING_METHODDEF
540#endif /* !defined(SIGNAL_SIGPENDING_METHODDEF) */
541
542#ifndef SIGNAL_SIGWAIT_METHODDEF
543 #define SIGNAL_SIGWAIT_METHODDEF
544#endif /* !defined(SIGNAL_SIGWAIT_METHODDEF) */
545
Antoine Pitrou9d3627e2018-05-04 13:00:50 +0200546#ifndef SIGNAL_VALID_SIGNALS_METHODDEF
547 #define SIGNAL_VALID_SIGNALS_METHODDEF
548#endif /* !defined(SIGNAL_VALID_SIGNALS_METHODDEF) */
549
Tal Einatc7027b72015-05-16 14:14:49 +0300550#ifndef SIGNAL_SIGWAITINFO_METHODDEF
551 #define SIGNAL_SIGWAITINFO_METHODDEF
552#endif /* !defined(SIGNAL_SIGWAITINFO_METHODDEF) */
553
554#ifndef SIGNAL_SIGTIMEDWAIT_METHODDEF
555 #define SIGNAL_SIGTIMEDWAIT_METHODDEF
556#endif /* !defined(SIGNAL_SIGTIMEDWAIT_METHODDEF) */
557
558#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
559 #define SIGNAL_PTHREAD_KILL_METHODDEF
560#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200561/*[clinic end generated code: output=4ed8c36860f9f577 input=a9049054013a1b77]*/