Skip to contentSkip to conversation

perl: Add option to enable threads

PATCH New Clayton Shotwell 3 participants 4 messages Jan 21, 2020 – Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perl: Add option to enable threads

From: Hector Kesari <[email protected]>

Add config option for Perl to enable threads usage.

---
Changes v1 -> v2:
- Changed references of PERL to Perl
- Added a warning about using Perl threads

---
 package/perl/Config.in | 13 +++++++++++++
 package/perl/perl.mk   |  4 ++++
 2 files changed, 17 insertions(+)
package/perl/Config.in +13 -0
index 32a3fd2ee9..34b87ee575 100644
@@ -24,4 +24,17 @@ config BR2_PACKAGE_PERL_MODULES
 	  Leave empty for all modules (as far as the external libraries
 	  are available).
 
+config BR2_PACKAGE_PERL_ENABLE_THREADS
+	bool "Support for Threads in Perl"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  Enable use of threads in Perl scripts
+
+	  WARNING: The use of interpreter-based threads in Perl
+	  is officially discouraged.
+	  See https://perldoc.perl.org/threads.html#WARNING
+
+comment "Perl threads need toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
 endif
package/perl/perl.mk +4 -0
index 0ab81ddb34..e0bbf9cfd4 100644
@@ -62,6 +62,10 @@ ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
 PERL_CONF_OPTS += -Dusedevel
 endif
 
+ifeq ($(BR2_PACKAGE_PERL_ENABLE_THREADS),y)
+PERL_CONF_OPTS += -Dusethreads
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 PERL_CONF_OPTS += --all-static --no-dynaloader
 endif
Signature · 1 line
2.23.0
#1 lore raw

PATCH v2 1/1 perl: Add option to enable threads

Quoted 23 lines · Clayton Shotwell

From: Hector Kesari <[email protected]>

Add config option for Perl to enable threads usage.

---
Changes v1 -> v2:
- Changed references of PERL to Perl
- Added a warning about using Perl threads

---
 package/perl/Config.in | 13 +++++++++++++
 package/perl/perl.mk   |  4 ++++
 2 files changed, 17 insertions(+)
package/perl/Config.in +0 -0
index 32a3fd2ee9..34b87ee575 100644
@@ -24,4 +24,17 @@ config BR2_PACKAGE_PERL_MODULES
 	  Leave empty for all modules (as far as the external libraries
 	  are available).

package/perl/Config.in config BR2_PACKAGE_PERL_MODULES · line 35

Quoted 10 lines
package/perl/Config.in +9 -0
 
+config BR2_PACKAGE_PERL_ENABLE_THREADS
+	bool "Support for Threads in Perl"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  Enable use of threads in Perl scripts
+
+	  WARNING: The use of interpreter-based threads in Perl
+	  is officially discouraged.
+	  See https://perldoc.perl.org/threads.html#WARNING

So why do you want it then?

Regards,
Arnout

Quoted 21 lines
package/perl/Config.in +4 -0
+
+comment "Perl threads need toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
 endif
package/perl/perl.mk +4 -0
index 0ab81ddb34..e0bbf9cfd4 100644
@@ -62,6 +62,10 @@ ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
 PERL_CONF_OPTS += -Dusedevel
 endif
 
+ifeq ($(BR2_PACKAGE_PERL_ENABLE_THREADS),y)
+PERL_CONF_OPTS += -Dusethreads
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 PERL_CONF_OPTS += --all-static --no-dynaloader
 endif
#2 lore raw

PATCH v2 1/1 perl: Add option to enable threads

Quoted 28 lines · Arnout Vandecappelle
Quoted 24 lines · Clayton Shotwell

From: Hector Kesari <[email protected]>

Add config option for Perl to enable threads usage.

---
Changes v1 -> v2:
- Changed references of PERL to Perl
- Added a warning about using Perl threads

---
 package/perl/Config.in | 13 +++++++++++++
 package/perl/perl.mk   |  4 ++++
 2 files changed, 17 insertions(+)
package/perl/Config.in +0 -0
index 32a3fd2ee9..34b87ee575 100644
@@ -24,4 +24,17 @@ config BR2_PACKAGE_PERL_MODULES
        Leave empty for all modules (as far as the external libraries
        are available).
 
Quoted 11 lines

package/perl/Config.in config BR2_PACKAGE_PERL_MODULES · line 35

Quoted 9 lines
package/perl/Config.in +9 -0
+config BR2_PACKAGE_PERL_ENABLE_THREADS
+     bool "Support for Threads in Perl"
+     depends on BR2_TOOLCHAIN_HAS_THREADS
+     help
+       Enable use of threads in Perl scripts
+
+       WARNING: The use of interpreter-based threads in Perl
+       is officially discouraged.
+       See https://perldoc.perl.org/threads.html#WARNING

So why do you want it then?

Goal of the program is to not modify the perl code since it "works". There may be others
with older code bases that could use the thread support.

Thanks,
Clayton

Quoted 25 lines

Regards,
Arnout

Quoted 21 lines
package/perl/Config.in +4 -0
+
+comment "Perl threads need toolchain w/ threads"
+     depends on !BR2_TOOLCHAIN_HAS_THREADS
+
 endif
package/perl/perl.mk +4 -0
index 0ab81ddb34..e0bbf9cfd4 100644
@@ -62,6 +62,10 @@ ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
 PERL_CONF_OPTS += -Dusedevel
 endif
 
+ifeq ($(BR2_PACKAGE_PERL_ENABLE_THREADS),y)
+PERL_CONF_OPTS += -Dusethreads
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 PERL_CONF_OPTS += --all-static --no-dynaloader
 endif
#3 lore raw

PATCH v2 1/1 perl: Add option to enable threads

In reply to Clayton Shotwell
Quoted 7 lines · On Tue, 21 Jan 2020 13:29:16 -0600 Clayton Shotwell…

From: Hector Kesari <[email protected]>

Add config option for Perl to enable threads usage.

Quoted 8 lines

---
Changes v1 -> v2:
- Changed references of PERL to Perl
- Added a warning about using Perl threads

---
 package/perl/Config.in | 13 +++++++++++++
 package/perl/perl.mk   |  4 ++++
 2 files changed, 17 insertions(+)

Even though Arnout was not sure, this patch has been around for a long time, the complexity is very low, so I applied to master with a few tweaks.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com