I wrote this:
use threads;
lock($lock);
cond_wait($full,$lock) while($threads == $max_thread);
$threads++;
unlock($lock);
After running this code, I am given the error:
Undefined subroutine &main::unlock called at ./pages.pl line 222, <FH> line 1.`
How can I resolve this?
Note that there is no unlock() function - the only way to unlock a variable is to allow it to go out of scope.
So,
{
lock($lock);
cond_wait($full,$lock) while($threads == $max_thread);
$threads++;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.