Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2011-01-04 17:59:55 +0300
committerTon Roosendaal <ton@blender.org>2011-01-04 17:59:55 +0300
commit5db20b512e3d3c87ee9310ba940232109d8e1f60 (patch)
treef2d203dc9a6b57fae8e87fe6a3a441c8b9dfc9d5 /source/blender/windowmanager/intern/wm_jobs.c
parentbecca813d796bca8c59c20b496f24f42277f25c7 (diff)
Todo item:
New option to start threaded wmJobs, with flag WM_JOB_SUSPEND. This makes the job wait 1 timer step before running. Used now for Material Icon render renders, which makes the big preview to be always rendered first while using UI.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_jobs.c')
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index b8dfae63b4d..591ed5c33b5 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -247,33 +247,40 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
wmJob *steve;
int suspend= 0;
- for(steve= wm->jobs.first; steve; steve= steve->next) {
- /* obvious case, no test needed */
- if(steve==test || !steve->running) continue;
-
- /* if new job is not render, then check for same startjob */
- if(0==(test->flag & WM_JOB_EXCL_RENDER))
- if(steve->startjob!=test->startjob)
- continue;
-
- /* if new job is render, any render job should be stopped */
- if(test->flag & WM_JOB_EXCL_RENDER)
- if(0==(steve->flag & WM_JOB_EXCL_RENDER))
- continue;
-
+ /* job added with suspend flag, we wait 1 timer step before activating it */
+ if(test->flag & WM_JOB_SUSPEND) {
suspend= 1;
+ test->flag &= ~WM_JOB_SUSPEND;
+ }
+ else {
+ /* check other jobs */
+ for(steve= wm->jobs.first; steve; steve= steve->next) {
+ /* obvious case, no test needed */
+ if(steve==test || !steve->running) continue;
+
+ /* if new job is not render, then check for same startjob */
+ if(0==(test->flag & WM_JOB_EXCL_RENDER))
+ if(steve->startjob!=test->startjob)
+ continue;
+
+ /* if new job is render, any render job should be stopped */
+ if(test->flag & WM_JOB_EXCL_RENDER)
+ if(0==(steve->flag & WM_JOB_EXCL_RENDER))
+ continue;
- /* if this job has higher priority, stop others */
- if(test->flag & WM_JOB_PRIORITY) {
- steve->stop= 1;
- // printf("job stopped: %s\n", steve->name);
+ suspend= 1;
+
+ /* if this job has higher priority, stop others */
+ if(test->flag & WM_JOB_PRIORITY) {
+ steve->stop= 1;
+ // printf("job stopped: %s\n", steve->name);
+ }
}
}
-
+
/* possible suspend ourselfs, waiting for other jobs, or de-suspend */
test->suspended= suspend;
// if(suspend) printf("job suspended: %s\n", test->name);
-
}
/* if job running, the same owner gave it a new job */
@@ -286,6 +293,7 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
// printf("job started a running job, ending... %s\n", steve->name);
}
else {
+
if(steve->customdata && steve->startjob) {
wm_jobs_test_suspend_stop(wm, steve);