From 1fe5fad280afd9a7d56ff23a8c30b838f79282b9 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 20 Dec 2009 21:34:02 -0800 Subject: [PATCH] kernel - lwkt_token code, minor fix to last commit * lwkt_getalltokens() has to release any partially acquired tokens when it fails to get them all. Fixes an issue with the last commit that could cause processes to get stuck in a Run state. --- sys/kern/lwkt_token.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/lwkt_token.c b/sys/kern/lwkt_token.c index ce5c01a839..143d0b589b 100644 --- a/sys/kern/lwkt_token.c +++ b/sys/kern/lwkt_token.c @@ -129,7 +129,8 @@ _lwkt_token_pool_lookup(void *ptr) /* * Obtain all the tokens required by the specified thread on the current - * cpu, return 0 on failure and non-zero on success. + * cpu, return 0 on failure and non-zero on success. If a failure occurs + * any partially acquired tokens will be released prior to return. * * lwkt_getalltokens is called by the LWKT scheduler to acquire all * tokens that the thread had acquired prior to going to sleep. @@ -180,8 +181,10 @@ lwkt_getalltokens(thread_t td) */ scan2 = td->td_toks; for (;;) { - if (scan2 == scan1) + if (scan2 == scan1) { + lwkt_relalltokens(td); return(FALSE); + } if (scan2 == ref) { tok->t_ref = scan1; break; -- 2.11.4.GIT