python748 / btstack

Automatically exported from code.google.com/p/btstack
0 stars 0 forks source link

Allow safe removal of data sources in the posix run loop #400

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In posix_execute, when iterating through the data sources, ds is advanced to 
ds->item.next in the for loop. But if the data source was removed (and freed) 
it isn't safe to access it directly in the for loop. 
I believe the "next" value should be cached before calling the "process" 
callback, like in the embedded run loop.

What version of the product are you using? On what operating system?
Present in the latest r2640.

Original issue reported on code.google.com by kob...@mce-sys.com on 15 Jun 2014 at 7:31

GoogleCodeExporter commented 8 years ago
Hi. I've implemented the new linked_list_iterator and used it in 
run_loop_posix. Could you repeat your test? There's also a unit test in 
test/linked_list that tries various actions to break it in case you think I've 
missed a special corner case.

Original comment by matthias.ringwald@gmail.com on 16 Jun 2014 at 9:36

GoogleCodeExporter commented 8 years ago
I've repeated my tests with the new linked_list_iterator and it seems to be 
working good (I didn't run the unit tests as I don't have cpputest configured). 
Thanks.

Original comment by kob...@mce-sys.com on 17 Jun 2014 at 9:33