Closed ChunMinChang closed 4 years ago
result on tryserver: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f68714a4cf88731e50fc9278d0d6ad78647bf98c&selectedJob=291020567
The error above is intermittent I think. It's robust in the today's tryserver: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9d125519db4836e37b0c069c41ab4f79c3c01129
Try results with new patches: https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=293110963&revision=a1e4f7ac0f6103fe2e1dab2b4fd1522814952b2e
The change made here can address #28, and make sure that no stream task can be executed after the stream is destroyed, which should avoid the potential data race.
The patch creates a struct
Queue
wrappingdispatch_queue_t
, which will retain and release the reference count ofdispatch_queue_t
when it's created/cloned, or destroyed. By creating the task queue in each stream, the stream's task that don't need to share the common data among all streams can be executed in each stream's own task queue. This change also brings another benefit: now we can know what task can be canceled. All the tasks appended after the stream-destroy task should be canceled.