mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-06-16 02:15:48 +00:00
added sharedarea_update api
This commit is contained in:
@@ -26,6 +26,13 @@ struct uwsgi_sharedarea *uwsgi_sharedarea_get_by_id(int id, uint64_t pos) {
|
||||
return sa;
|
||||
}
|
||||
|
||||
int uwsgi_sharedarea_update(int id) {
|
||||
struct uwsgi_sharedarea *sa = uwsgi_sharedarea_get_by_id(id, 0);
|
||||
if (!sa) return -1;
|
||||
sa->updates++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uwsgi_sharedarea_rlock(int id) {
|
||||
struct uwsgi_sharedarea *sa = uwsgi_sharedarea_get_by_id(id, 0);
|
||||
if (!sa) return -1;
|
||||
|
||||
@@ -1512,6 +1512,22 @@ PyObject *py_uwsgi_sharedarea_write(PyObject * self, PyObject * args) {
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject *py_uwsgi_sharedarea_update(PyObject * self, PyObject * args) {
|
||||
int id;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:sharedarea_update", &id)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (uwsgi_sharedarea_update(id)) {
|
||||
return PyErr_Format(PyExc_ValueError, "error calling uwsgi_sharedarea_update()");
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
}
|
||||
|
||||
PyObject *py_uwsgi_sharedarea_rlock(PyObject * self, PyObject * args) {
|
||||
int id;
|
||||
|
||||
|
||||
@@ -4605,6 +4605,7 @@ int uwsgi_sharedarea_wait(int, int, int);
|
||||
int uwsgi_sharedarea_unlock(int);
|
||||
int uwsgi_sharedarea_rlock(int);
|
||||
int uwsgi_sharedarea_wlock(int);
|
||||
int uwsgi_sharedarea_update(int);
|
||||
|
||||
struct uwsgi_sharedarea *uwsgi_sharedarea_get_by_id(int, uint64_t);
|
||||
int uwsgi_websocket_send_from_sharedarea(struct wsgi_request *, int, uint64_t, uint64_t);
|
||||
|
||||
Reference in New Issue
Block a user