added uwsgi.ready()

This commit is contained in:
roberto@precise64
2012-04-24 21:50:00 +02:00
parent 672c49e8eb
commit 74a9b1b41d
5 changed files with 26 additions and 2 deletions
+4
View File
@@ -189,6 +189,10 @@ int uwsgi_python_init() {
Py_Initialize();
if (!uwsgi.has_threads) {
uwsgi_log("*** Python threads support is disabled. You can enable it with --enable-threads ***\n");
}
up.wsgi_spitout = PyCFunction_New(uwsgi_spit_method, NULL);
up.wsgi_writeout = PyCFunction_New(uwsgi_write_method, NULL);
+13
View File
@@ -1025,6 +1025,17 @@ PyObject *py_uwsgi_setprocname(PyObject * self, PyObject * args) {
return Py_None;
}
PyObject *py_uwsgi_ready(PyObject * self, PyObject * args) {
if (ushared->ready) {
Py_INCREF(Py_True);
return Py_True;
}
Py_INCREF(Py_None);
return Py_None;
}
PyObject *py_uwsgi_in_farm(PyObject * self, PyObject * args) {
char *farm_name = NULL;
@@ -3103,6 +3114,8 @@ static PyMethodDef uwsgi_advanced_methods[] = {
{"mule_get_msg", (PyCFunction) py_uwsgi_mule_get_msg, METH_VARARGS|METH_KEYWORDS, ""},
{"farm_get_msg", py_uwsgi_farm_get_msg, METH_VARARGS, ""},
{"in_farm", py_uwsgi_in_farm, METH_VARARGS, ""},
{"ready", py_uwsgi_ready, METH_VARARGS, ""},
//{"call_hook", py_uwsgi_call_hook, METH_VARARGS, ""},
{NULL, NULL},