LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-18-2022, 05:35 PM   #31
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176

suppose i want to do a group wait that includes waiting for signal SIGUSR2. the signal will be sent by another process to this process. how can the child process be made to wait on a signal sent to its parent ... in each language?

i have reluctance to use more processes. maybe threads can be used? a process just uses more resources. this should have been designed better, such as a way to associate other waits with a file descriptor so select or poll can be used (making it easier for other language implementations to do without the weight of a process for each wait).
 
Old 03-18-2022, 05:44 PM   #32
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by chrism01 View Post
If you are trying to move away from C, try Perl.
It can do that sort of stuff; you just need to decide which method to use.
For in-depth answers & options, try perlmonks.org; that's where the gurus hangout.
i want to have it be done in any language, using ones that now do it serving as examples. how would you express on signal SIGUSR2 when preparing to do a group wait?
 
Old 03-19-2022, 04:43 AM   #33
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,918

Rep: Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035
Quote:
Originally Posted by Skaperen View Post
is it possible for libevent to just return an event rather than do a callback?
You'd have to read the docs, but from what I read it sounds like libevent is based around callbacks, so likely, no. I've never used it myself, I only know its out there.
 
Old 03-22-2022, 11:15 PM   #34
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
Like I said, you should ask the guys over at perlmonks.org.

Perl can definitely do what you need in terms of objectives, but (like any other language) there is definitely more than one way to do it.
There are in fact many modules related to process & event handing and communications; it's a qn of choosing the best one(s) for your particular job.
The Perl docs are here https://perldoc.perl.org/ and the modules here https://www.cpan.org/modules/index.html.
 
Old 03-22-2022, 11:37 PM   #35
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by Skaperen View Post
which languages have a way to wait on 2 or more things at the same time.
Some folks have already pointed out that many languages have this. I'm not sure if I'd attribute this ability to any programming language but an operating system feature that a language can get access to via some library calls.

Quote:
easily, without doing programming tricks?
IMHO, doing something like this is already a bit of a programming trick. (First encountered while writing FORTRAN programs on PDP-11s running RSX-11M -- event flags, ASTs/traps, etc. were de rigeur when interfacing with lab devices -- so the idea has been around under different names for quite a while. After working with those for a while, those "programming tricks" become second nature.)
 
Old 03-24-2022, 08:36 PM   #36
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
what i want to have in a language is some kind of value instance of some class representing all possible things to wait for that can be put in a collective (in Python, maybe a frozenset) to pass to the wait call. in C i have done many kinds of waits, but there were many ways they were coded. higher level languages are where this should be smoothed out to hide the details few programs need to know about.

i need to wait on the reference object returned by foobar() and also one passed to this function in argument thing.
 
Old 03-25-2022, 01:19 AM   #37
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
This is the wait call:
Quote:
The wait() system call suspends execution of the calling process until one of its children terminates.
From the other hand you need to implement if you need something different. And you need to describe your situation better.
 
Old 03-25-2022, 01:27 PM   #38
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by pan64 View Post
This is the wait call:

From the other hand you need to implement if you need something different. And you need to describe your situation better.
it would be implemented as part of that language, if there is such a thing.
 
Old 03-25-2022, 06:59 PM   #39
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Did I mention Node and Go?

Last edited by dugan; 03-25-2022 at 08:41 PM.
 
Old 03-28-2022, 12:59 AM   #40
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by Skaperen View Post
it would be implemented as part of that language, if there is such a thing.
that wait is available on almost every high level language. Usually all the low level c calls are implemented (like os.wait in python).
 
Old 03-28-2022, 08:26 AM   #41
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
If you're doing this in Python, use asyncio.
 
Old 03-29-2022, 08:02 PM   #42
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by dugan View Post
If you're doing this in Python, use asyncio.
so, asyncio has a way to wait for signals, and everything else? i'm wondering if Python is the language to go with. it would be nice if so.
 
Old 03-30-2022, 02:02 AM   #43
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by Skaperen View Post
so, asyncio has a way to wait for signals, and everything else? i'm wondering if Python is the language to go with. it would be nice if so.
you still did not specify what do you want to achieve, therefore nobody knows the answer. All high level languages can handle signals and [almost] everything else.
 
Old 03-30-2022, 08:14 AM   #44
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
You might be better to take a step back from this requirement – this is one area where different operating systems vary substantially – and look for some kind of "workload manager infrastructure" into which you can then hang your application, waiting on a provided serial queue of incoming events.
 
Old 03-30-2022, 07:22 PM   #45
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,689

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by sundialsvcs View Post
You might be better to take a step back from this requirement – this is one area where different operating systems vary substantially – and look for some kind of "workload manager infrastructure" into which you can then hang your application, waiting on a provided serial queue of incoming events.
even if it is not part of a language, if such a thing (workload manager infrastructure) exists, it would be for some language (or a few) to model the concept. if it exists, i wanted to know for which language(s). so, perhaps, it does not exist in such a form.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do we have to use "yum update" command every week or we have to wait more? yeknafar Linux - Newbie 8 07-16-2018 09:07 AM
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 10:10 AM
prevent users to run the same script at the same time, on the same machine pvpnguyen Programming 2 09-05-2007 08:52 PM
I download then wait and download and wait... jsheffie SUSE / openSUSE 1 11-04-2005 04:43 PM
languages of linux: which languages can be choosen in suse and red-hat distributions? Klaus Schnorr Linux - Software 3 09-10-2005 02:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration