version 1.1, 2006/03/08 20:18:41 |
version 1.2, 2006/03/10 00:48:56 |
|
|
cvs_worklist_run(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) |
cvs_worklist_run(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) |
{ |
{ |
sigset_t old, new; |
sigset_t old, new; |
|
struct cvs_worklist *wkl; |
|
|
sigfillset(&new); |
sigfillset(&new); |
sigprocmask(SIG_BLOCK, &new, &old); |
sigprocmask(SIG_BLOCK, &new, &old); |
|
|
cvs_worklist_clean(list, cb); |
cvs_worklist_clean(list, cb); |
|
|
|
while ((wkl = SLIST_FIRST(list)) != NULL) { |
|
SLIST_REMOVE_HEAD(list, wkl_list); |
|
xfree(wkl); |
|
} |
|
|
sigprocmask(SIG_SETMASK, &old, NULL); |
sigprocmask(SIG_SETMASK, &old, NULL); |
} |
} |
|
|
/* |
/* |
* clean the worklist by passing the elements to the specified callback |
* pass elements to the specified callback, which has to be signal safe. |
*/ |
*/ |
void |
void |
cvs_worklist_clean(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) |
cvs_worklist_clean(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) |
{ |
{ |
struct cvs_worklist *wkl; |
struct cvs_worklist *wkl; |
|
|
while ((wkl = SLIST_FIRST(list)) != NULL) { |
while ((wkl = SLIST_FIRST(list)) != NULL) |
SLIST_REMOVE_HEAD(list, wkl_list); |
|
cb(wkl); |
cb(wkl); |
xfree(wkl); |
|
} |
|
} |
} |
|
|
void |
void |