You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/temporary_document_of_AQ.md
+90Lines changed: 90 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,5 +97,95 @@ async def main():
97
97
asyncwith cx_Oracle_async.create_pool(user='' , password='' , dsn= dsn) as oracle_pool:
98
98
await features(oracle_pool)
99
99
100
+
asyncio.run(main())
101
+
```
102
+
103
+
It is noteworthy that since we were not implement this library asynchronous in a very basic level ,yet it's just a wrapper of synchronous functions via threads , that makes it not gonna work if you are doing two different things in a single connection at a time. For example in the following situation the code will **NOT** work:
As we planned , there should be a fetching thread(coroutine) start fetcing , this action will block since the queue is empty , and will return until there's something put into the queue. Then after one second sleep , the main thread will put 'Hello World' into AQ and that will trigger the blocked fetching thread , and then the whole program terminated.
142
+
143
+
However we will find the program blocking forever in real practice. That's because since `queue.deqOptions.wait` equals to `cx_Oracle.DEQ_WAIT_FOREVER` thus while there's nothing in the queue , the query will block **AND** this will take over the control of connection thread , which makes it impossible for the following code to put anything into the queue using the same thread, thus makes it a deadlock.
144
+
145
+
If you would like to achieve the same result , you should do that in **ANOTHER** connection thread. Simply modify the code as follow:
0 commit comments