- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try explicit library initialization with a task_scheduler_init object, and after it is destroyed or its terminate() method is called, make the program sleep a little before exiting. This may help.
The explanation is that TBB worker threads are detached, i.e. the library signals them to shut down but does not wait for their completion. If the process exits right after TBB is deinitialized, worker threads could just get killed; no guarantee that they complete shutdown code. By adding some wait before process exit you give the threads some time to complete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Alexy. Sleep seems to work, but as you said, only in cases of explicit initialization and termination of the library. I was wondering if I could resolve this issue at the library level by moving the writes to the file to a location prior to the signalling of the shutdown. Any hints regarding that? Another option that comes to my mind is using a shared data structure, so that the master can extract all the information from it, and only the master writes to the file.
PS: on_scheduler_exit faces the same limitation right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes on_scheduler_exit can be missed due to the same reason.
As for hints... In TBB 2.2, look for terminate_workers, and go both up and down the call stack to find a suitable place for statistics dump.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page