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;
|
||||
|
||||
// dequeue payload
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
status = dpiConn_deqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
||||
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
||||
&messageIdValue, &messageIdLength);
|
||||
Py_END_ALLOW_THREADS
|
||||
cxoBuffer_clear(&nameBuffer);
|
||||
if (status < 0)
|
||||
return cxoError_raiseAndReturnNull();
|
||||
@ -1512,9 +1514,11 @@ static PyObject *cxoConnection_enqueue(cxoConnection *conn, PyObject* args,
|
||||
return NULL;
|
||||
|
||||
// enqueue payload
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
status = dpiConn_enqObject(conn->handle, nameBuffer.ptr, nameBuffer.size,
|
||||
optionsObj->handle, propertiesObj->handle, payloadObj->handle,
|
||||
&messageIdValue, &messageIdLength);
|
||||
Py_END_ALLOW_THREADS
|
||||
cxoBuffer_clear(&nameBuffer);
|
||||
if (status < 0)
|
||||
return cxoError_raiseAndReturnNull();
|
||||
|
||||
@ -192,7 +192,7 @@ int cxoQueue_deqHelper(cxoQueue *queue, uint32_t *numProps,
|
||||
const char *buffer;
|
||||
cxoMsgProps *temp;
|
||||
cxoObject *obj;
|
||||
int ok;
|
||||
int ok, status;
|
||||
|
||||
// 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
|
||||
@ -200,7 +200,10 @@ int cxoQueue_deqHelper(cxoQueue *queue, uint32_t *numProps,
|
||||
handles = (dpiMsgProps**) props;
|
||||
|
||||
// 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();
|
||||
|
||||
// create objects that are returned to the user
|
||||
@ -298,7 +301,10 @@ int cxoQueue_enqHelper(cxoQueue *queue, uint32_t numProps,
|
||||
}
|
||||
|
||||
// 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 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user