In general, Thread safety can be attained either by applying a condition or using the same array twice for parallel processing. In Logic Apps, If the parallel processes have 2 for each loop, then you don't have to think about thread safety.

This takes the same array as 2 separate arrays.

Below is the code-view of my logic app
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Compose": {
"inputs": "@items('For_each')",
"runAfter": {},
"type": "Compose"
}
},
"foreach": "@variables('Array')",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"For_each_2": {
"actions": {
"Compose_2": {
"inputs": "@items('For_each_2')",
"runAfter": {},
"type": "Compose"
}
},
"foreach": "@variables('Array')",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "Array",
"type": "array",
"value": [
1,
2,
3,
4,
5
]
}
]
},
"runAfter": {},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}