473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Semaphores for ithreads

arne
315 Expert 100+
Hi,

I am using Perl ithreads. The threads I create shall access a shared hash.
In order to control access to the hash, I would like to use a semaphore. (BTW, does the hash need the protection at all if I can make sure that all threads use different keys?)

Semaphores in Perl are provided by the (obsolete?) "Thread" module, which has been replaced by the "threads" module in recent versions. But in the latter, there are only locks, no semaphores ... or at least I don't see it.

So, the way to go would be to explicitely share() the hash and then use Thread::Semaphores to protect it? Seems awkward to me ...

Are there any better (and probably more obvious) possibilities?

TIA,
arne
May 24 '07 #1
0 1125

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Taewoon Kwon | last post by:
Nowadays, I learn about perl ithreads, reading perlthrtut perldoc. I tested a sample code in that document #---code start use threads; $thr = threads->new(\&sub1); @ReturnData =...
1
by: Nish | last post by:
Hi, I have some code, to which I added usage of posix semaphores. I am working on a solaris platform. After doing that, my process becomes unkillable, that is it will not terminate if sent a...
1
by: Mehmet Turker | last post by:
Hi; In a research project, I want to use shared memory with semaphores. First I have to create an environment for interprocess messaging. I'm thinking of having a main process which creates a big...
2
by: schneider jp | last post by:
Hi everybody For a project of system programming, we need to use semaphores, but i got some pbs... when I compile, i get perror with sem_open("machin", O_CREAT, 0666, 0); and perror says...
11
by: FiLH | last post by:
Hello, I would like to know if posix semaphores are inter processes or just semaphores for threads inside the same process. I have not seen it defined in the posix specification I have found,...
1
by: jinksk | last post by:
I have a C# application and a VB6 application that need to share a dialup connection to the internet. Don't ask why, this is one of those corporate "do or die" things. The only way I can see to...
1
by: Edwin New | last post by:
I have a requirement to run two separate postmasters on the one machine. It looks like they compete for resources (semaphores) so won't run concurrently. I compiled twice, specifying different...
0
by: The Advocate | last post by:
Hello, how can we implement semaphores using monitors. I got how we can do it the way round. I did alot of search but couldnt find any implementation of semaphores using monitors,. Can anyone help me...
5
by: davidcollins001 | last post by:
Hi, Firstly please excuse the long ramblingness. I need some conceptual help, I am trying to make two programs that are exactly the same but take it in turns to execute something, so the output...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.