Skip to content

Lock-PodeObject

SYNOPSIS

Places a temporary lock on a object while a ScriptBlock is invoked.

SYNTAX

Lock-PodeObject [-Object] <Object> [-ScriptBlock] <ScriptBlock> [-Return] [-CheckGlobal] [<CommonParameters>]

DESCRIPTION

Places a temporary lock on a object while a ScriptBlock is invoked.

EXAMPLES

EXAMPLE 1

Lock-PodeObject -Object $SomeArray -ScriptBlock { /* logic */ }

EXAMPLE 2

$result = (Lock-PodeObject -Return -Object $SomeArray -ScriptBlock { /* logic */ })

PARAMETERS

-CheckGlobal

If supplied, will check the global Lockable object and wait until it's freed-up before locking the passed object.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Object

The object to lock.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Return

If supplied, any values from the ScriptBlock will be returned.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ScriptBlock

The ScriptBlock to invoke.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Object

NOTES