Skip to content

process iopub events in order#283

Merged
takluyver merged 2 commits into
ipython:masterfrom
minrk:order-stream-events
Nov 28, 2017
Merged

process iopub events in order#283
takluyver merged 2 commits into
ipython:masterfrom
minrk:order-stream-events

Conversation

@minrk

@minrk minrk commented Nov 27, 2017

Copy link
Copy Markdown
Member
  • events is an OrderedDict a deque
  • process all events when an event arrives

avoids fair-queue issues with multiple writes from concurrent threads

This means that sometimes an event will arrive with nothing to do, but that's fine

closes spyder-ide/qtconsole#246

- events is an OrderedDict
- process all events when an event arrives

avoids fair-queue issues with multiple writes from concurrent threads

This means that sometimes an event will arrive with nothing to do, but that's fine
OrderedDict isn't thread-safe
@takluyver

Copy link
Copy Markdown
Member

Is there a reason you picked a deque rather than a queue.Queue?

@minrk

minrk commented Nov 28, 2017

Copy link
Copy Markdown
Member Author

queue.Queue uses locks, which we had to remove from stdout.write in #199. This would be way easier if we could use locks (we wouldn't need the zmq pipes at all). But deque is threadsafe according to the docs, at least insofar as we are using it here (read only existing items from the left in one thread, write them on the right in others).

@takluyver

Copy link
Copy Markdown
Member

Gotcha, thanks.

@takluyver takluyver merged commit cea3d93 into ipython:master Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

thread/lock mechanism appeared bugged in the console, indeed!

2 participants