[sf-perl] threads, threads::shared, and multiple locked variables

David Christensen dpchrist at holgerdanske.com
Wed Jul 8 16:38:50 PDT 2020


sanfrancisco-pm:

I have been experimenting with concurrent programming with Perl, 
threads, and threads::shared.  I have successfully used a shared 
variable, lock(), cond_wait(), and cond_broadcast() to ensure 
thread-safe access to one shared resource.


I would now like to ensure thread-safe access to multiple shared 
resources.  Specifically, if a thread desires access to any one of 
several shared resources, how can it block, wake up when one resource is 
available (and locked), and determine which resource to access?


David


More information about the SanFrancisco-pm mailing list