]> git.tuebingen.mpg.de Git - paraslash.git/commit
sched: Provide alternative post_select variant.
authorAndre Noll <maan@systemlinux.org>
Sun, 31 Mar 2013 12:32:07 +0000 (12:32 +0000)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Apr 2013 12:12:45 +0000 (14:12 +0200)
commit9c00a79ed817c854ed10ee6bd1b908df8dc13a2f
tree459f3000a0b4590f25c014f31bbc152714e9a88d
parent24758c5f17064273786e704b84ceff56c234e347
sched: Provide alternative post_select variant.

Code which accesses the ->error field of another task has been
a source of bugs in the past. This patch is a first step to make
->error private to sched.c.

Currently the ->post_select() methods of all tasks are supposed
to set ->error to a negative value to indicate that the task
should be terminated, i.e. t->error being negative instructs the
scheduler to not call t->pre_select() or t->post_select() any more
in subsequent iterations.  An equivalent way to achieve the same
is to let ->post_select() return an error code instead. Benefits
include

* It reduces the use of ->error outside of sched.c
* It's impossible to miss setting the error code
* It simplifies code slightly

Therefore we'd like to change the prototype of the ->post_select()
methods from

void (*post_select)(struct sched *s, struct task *t);
to
int (*post_select)(struct sched *s, struct task *t);

Changes to struct sched affects many parts of the code base,
hence converting all users at once would result in a very
large patch. Therefore we temporarily introduce an additional
->new_post_select() method according to the second declaration
above. The scheduler calls the new method if it is defined and falls
back to the old variant otherwise. This approach allows to switch
over one task after another without breaking things.

This patch introduces the infrastructure just described and switches
over the http receiver. Subsequent commits will change all other tasks
in the same way. After all tasks have been switched over we can get
rid of the old ->post_select variant and rename ->new_post_select()
back to ->post_select().
audiod.c
filter.c
filter.h
http_recv.c
play.c
recv.c
recv.h
sched.c
sched.h
write.h
write_common.c