added sharedarea_update api

This commit is contained in:
Unbit
2013-12-10 09:06:27 +01:00
parent 5bb7f02921
commit 304f847dc6
3 changed files with 24 additions and 0 deletions
+7
View File
@@ -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;
+16
View File
@@ -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;
+1
View File
@@ -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);