Skip to content

Multithreading with Runspaces #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Move $RunspaceOps into config file
  • Loading branch information
Carterpersall committed Sep 8, 2022
commit 2e43db131ddda35ea6ebdaf069af32749ca6748e
62 changes: 31 additions & 31 deletions winfetch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,37 @@ $defaultConfig = @'

# Configure whether to run in multiple threads using runspaces
# Disabling will reduce speed, but may be useful for debugging
# $runspaces = $true
$runspaces = $true

# Operations to execute in runspaces
$RunspaceOps = @(
"title"
"dashes"
"os"
"computer"
"kernel"
"motherboard"
"custom_time"
"uptime"
"ps_pkgs"
"pkgs"
"pwsh"
"resolution"
"terminal"
"theme"
"cpu"
"gpu"
"cpu_usage"
#"memory" # Causes Errors
"disk"
#"battery" # Causes Errors
"locale"
"weather"
"local_ip"
"public_ip"
"blank"
"colorbar"
)

# Use the following option to specify custom package managers.
# Create a function with that name as suffix, and which returns
Expand Down Expand Up @@ -1136,36 +1166,6 @@ if ($Runspaces){
$RunspacePool.Open()
$Jobs = New-Object System.Collections.ArrayList

# Operations to execute on another thread
$RunspaceOps = @(
"title"
"dashes"
"os"
"computer"
"kernel"
"motherboard"
"custom_time"
"uptime"
"ps_pkgs"
"pkgs"
"pwsh"
"resolution"
"terminal"
"theme"
"cpu"
"gpu"
"cpu_usage"
#"memory" # Causes Errors
"disk"
#"battery" # Causes Errors
"locale"
"weather"
"local_ip"
"public_ip"
"blank"
"colorbar"
)

# Create and Execute Runspaces
foreach ($Op in $RunspaceOps){
if($config -like $Op){
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy