-
Notifications
You must be signed in to change notification settings - Fork 75
Journald GIL release #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Journald GIL release #170
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| # Install compilation dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| gcc \ | ||
| pkg-config \ | ||
| libsystemd-dev \ | ||
| make \ | ||
| git \ | ||
| meson \ | ||
| jq \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN pip install --no-cache-dir wheel build | ||
|
|
||
| WORKDIR /src | ||
|
|
||
| # Fix git ownership issue | ||
| RUN git config --global --add safe.directory /src |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure anybody here uses docker, especially in the branded Docker way (instead of unbranded spec ones) we're more mkosi people, so these files are are wont to bit rot. Also, it's using the Makefile and we've switched to meson. I'd just drop this and the compose file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| services: | ||
| make: | ||
| build: . | ||
| volumes: | ||
| - .:/src | ||
| - ./build:/build | ||
| - ./dist:/dist | ||
| entrypoint: /usr/bin/make | ||
| command: all |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| # SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
|
||
| option('docs', type : 'boolean', value : false) | ||
| option('journal_unlock_gil', type: 'integer', value: 1, description: 'unlock gil before sending log to journal') |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,14 @@ | |
| #include "macro.h" | ||
| #include "pyutil.h" | ||
|
|
||
|
|
||
| #if defined(SD_JOURNAL_SENDV_UNLOCK_GIL) && (SD_JOURNAL_SENDV_UNLOCK_GIL == 1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the prefix |
||
| #define JOURNAL_SENDV_UNLOCK_GIL 1 | ||
| #else | ||
| #define JOURNAL_SENDV_UNLOCK_GIL 0 | ||
| #endif | ||
|
|
||
|
|
||
| PyDoc_STRVAR(journal_sendv__doc__, | ||
| "sendv('FIELD=value', 'FIELD=value', ...) -> None\n\n" | ||
| "Send an entry to the journal." | ||
|
|
@@ -43,8 +51,14 @@ static PyObject* journal_sendv(PyObject *self _unused_, PyObject *args) { | |
| iov[i].iov_len = length; | ||
| } | ||
|
|
||
| #if (JOURNAL_SENDV_UNLOCK_GIL == 1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you comment on the thread safety of this? |
||
| Py_BEGIN_ALLOW_THREADS | ||
| #endif | ||
| /* Send the iovector to the journal. */ | ||
| r = sd_journal_sendv(iov, argc); | ||
| #if (JOURNAL_SENDV_UNLOCK_GIL == 1) | ||
| Py_END_ALLOW_THREADS | ||
| #endif | ||
| if (r < 0) { | ||
| errno = -r; | ||
| PyErr_SetFromErrno(PyExc_OSError); | ||
|
|
@@ -111,6 +125,11 @@ PyMODINIT_FUNC PyInit__journal(void) { | |
| return NULL; | ||
| } | ||
|
|
||
| if (PyModule_AddIntConstant(m, "__sendv_unlock_gil__", JOURNAL_SENDV_UNLOCK_GIL)) { | ||
| Py_DECREF(m); | ||
| return NULL; | ||
| } | ||
|
|
||
| return m; | ||
| } | ||
| REENABLE_WARNING; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New targets shouldn't go in the Makefile.