Changes between Version 1 and Version 2 of ThreadCommunication
- Timestamp:
- Apr 12, 2011, 3:55:13 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ThreadCommunication
v1 v2 5 5 2. Common operations are need to be hand written each time requiring careful review of tricky lifetime code which is easy to get wrong. 6 6 7 To fix these, it would be good to have some common data structures which handle common operations without requiring much boilerplate code. Let's start by enumerating out common cases.7 To fix these, it would be good to have some common data structures/api which handle common operations without requiring much boilerplate code. Let's start by enumerating out common cases. 8 8 9 9 '''Use cases''' … … 17 17 This does look suspiciously like a nested message loop with a filter which many people regard as evil. The only reason to allow this capability is for synchronous calls from javascript to call to the main thread to get some work done and act like a synchronous call but there may be callbacks (e.g. when doing a sync xhr call.) Theoretically, the javascript engine could roll up its state into a closure and we could avoid the nested message loop but that capability doesn't exist in the engines that we deal with and would be very expensive to add to them. 18 18 19 3. Allowing for a thread pool scenario. (This isn't about implementing the thread pool but ensuring that the implementation suggested doesn't preclude one being done in the future). 19 Constraints: 20 The api should be simple to use and handle things like ensuring objects are appropriately copied or ref counted and make it easier to deal with lifetime issues. 21 22 Either object should be able to be deleted at any time and the other side shouldn't cause any memory corruption issues by sending more messages. 23 24 Allow for a thread pool scenario. (This isn't about implementing the thread pool but ensuring that the implementation suggested doesn't preclude one being done in the future). 20 25 21 26 TBD: There are likely more use cases to be listed here.