Hello everyone,
I'm a perl beginner. I created a piece of code starting a first thread which
in turn creates a second thread. Unfortunately the creation of the second
thread hangs the first one. Is there anybody who knows what's going on ?.
I decided to create fully OO software and I wouldn't like to go back into a
fork-based solution.
I also included my test application (I know there are no joins but it's only
for testing purposes)
--------------- test.pl -----------------------
#!/usr/bin/perl -w
use strict;
use Config;
$Config{useithr eads} or die "recompile Perl with threads to run this
program.";
use ThrdTest;
#new object
my $object = ThrdTest->new;
#does sth
$object->start;
#wait for a carrige return
my $svalue = <>;
print "\nFINISHED \n";
------------ ThrdTest.pm ------------
package ThrdTest;
use strict;
use threads;
sub new {
my $class = shift;
my $self = {};
bless $self , $class;
return $self;
}
sub start {
my $self = shift;
threads->new(\&aaa, $self, "1");
threads->new(\&ddd, $self,"2");
}
sub aaa {
my $self = shift;
my $val = shift;
while(1) {
print $val;
}
}
sub ddd{
my $self = shift;
my $val = shift;
threads->new(\&aaa, $self, $val); # THE FIRST THREAD STALLS RIGHT HERE
}
return 1;
--------------------------------
Thank you in advance.
--
pawo
[spadam b za duzo gadam] 0 1282 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Smith |
last post by:
Hello,
I have a rather odd question. My company is an all java/oracle shop.
We do everything is Java... no matter what it is... parsing of text
files, messaging, gui you name it. My question is this... is Perl so
much better at parsing text files and outputing that we would see a
substantial speed increase? We process about 10 million records in
flat files a day for reformatting before putting them in a DB.
Also, when it comes to...
|
by: Olivier Scalbert |
last post by:
Hello ,
What is the python way of doing this :
perl -pi -e 's/string1/string2/' file
?
Thanks
Olivier
|
by: Miguel Manso |
last post by:
Hi, list.
I'm into a psicological doubt that I would like to share with you
(you'll know why later on this mail).
I'm a programmer with 5 year of experience into Perl. I'm on that point
where you resolve problems without thinking on HOW you'll do it with
that language but only on the problem itself.
Since Perl 6 started I've been following it. The conclusion I have is
|
by: DP |
last post by:
(2nd post, I think my first may have been to the wrong group - sorry)
Hello Perl-ers -
I´m hoping I can get some help here, because I'm very lost. Don't know
Perl, I'm not a programmer. And this is something that has worked for
me earlier, only now it doesn't anymore.
---------------------------------
The ¨problem¨ script -
|
by: Ivan |
last post by:
Hi
I have following problem: I'm creating two threads who are performing some
tasks. When one thread finished I would like to restart her again (e.g. new
job). Following example demonstrates that. Problem is that when program is
started many threads are created (see output section), when only two should
be running at any time. Can you please help me to identify me where the
problem is?
Best regards
| |
by: Kirt Loki Dankmyer |
last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile
it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of
different switches, but I can't get it to compile. I need it to be
compiled with threads.
Anyone have any wisdom on how best to do this?
Here's a transcript of my latest attempt. It's long; you might want to
skip to the bottom, where I try "make" and the fatal errors start
happening.
|
by: Alex |
last post by:
I'm not exactly sure how to use these two languages together. It seems
to me that they both totally different things.
PERL = databases, heavy processing, server functions. But I can also
write HTML with it and just call a CSS to do all the design work.
JavaScript = ?? (I'm really not sure what to put -- AJAX??)
Help me out folks, I'm new at this..
|
by: incd |
last post by:
Hello,
I started out learning Perl today, but strict mode is just *weird* and not usefull? Why should I use it?
What makes $Username different than the other variables?
I was wondering, why I have to use "my ($Username)" to get this working:
#!/usr/bin/perl -w
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |