Release the Python GIL while enqueuing and dequeuing messages!
This commit is contained in:
parent
df56c7f17f
commit
e38b4af987
@ -1469,9 +1469,11 @@ static PyObject *cxoConnection_dequeue(cxoConnection *conn, PyObject* args,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// dequeue payload
|
// dequeue payload
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
status = dpiConn_deqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
status = dpiConn_deqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
||||||
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
||||||
&messageIdValue, &messageIdLength);
|
&messageIdValue, &messageIdLength);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
cxoBuffer_clear(&nameBuffer);
|
cxoBuffer_clear(&nameBuffer);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return cxoError_raiseAndReturnNull();
|
return cxoError_raiseAndReturnNull();
|
||||||
@ -1512,9 +1514,11 @@ static PyObject *cxoConnection_enqueue(cxoConnection *conn, PyObject* args,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// enqueue payload
|
// enqueue payload
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
status = dpiConn_enqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
status = dpiConn_enqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
||||||
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
||||||
&messageIdValue, &messageIdLength);
|
&messageIdValue, &messageIdLength);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
cxoBuffer_clear(&nameBuffer);
|
cxoBuffer_clear(&nameBuffer);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return cxoError_raiseAndReturnNull();
|
return cxoError_raiseAndReturnNull();
|
||||||
|
|||||||
@ -192,7 +192,7 @@ int cxoQueue_deqHelper(cxoQueue *queue, uint32_t *numProps,
|
|||||||
const char *buffer;
|
const char *buffer;
|
||||||
cxoMsgProps *temp;
|
cxoMsgProps *temp;
|
||||||
cxoObject *obj;
|
cxoObject *obj;
|
||||||
int ok;
|
int ok, status;
|
||||||
|
|
||||||
// use the same array to store the intermediate values provided by ODPI-C;
|
// use the same array to store the intermediate values provided by ODPI-C;
|
||||||
// by doing so there is no need to allocate an additional array and any
|
// by doing so there is no need to allocate an additional array and any
|
||||||
@ -200,7 +200,10 @@ int cxoQueue_deqHelper(cxoQueue *queue, uint32_t *numProps,
|
|||||||
handles = (dpiMsgProps**) props;
|
handles = (dpiMsgProps**) props;
|
||||||
|
|
||||||
// perform dequeue
|
// perform dequeue
|
||||||
if (dpiQueue_deqMany(queue->handle, numProps, handles) < 0)
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
status = dpiQueue_deqMany(queue->handle, numProps, handles);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
if (status < 0)
|
||||||
return cxoError_raiseAndReturnInt();
|
return cxoError_raiseAndReturnInt();
|
||||||
|
|
||||||
// create objects that are returned to the user
|
// create objects that are returned to the user
|
||||||
@ -298,7 +301,10 @@ int cxoQueue_enqHelper(cxoQueue *queue, uint32_t numProps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// perform enqueue
|
// perform enqueue
|
||||||
if (dpiQueue_enqMany(queue->handle, numProps, handles) < 0)
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
status = dpiQueue_enqMany(queue->handle, numProps, handles);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
if (status < 0)
|
||||||
return cxoError_raiseAndReturnInt();
|
return cxoError_raiseAndReturnInt();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user