<p>Use avp, xavp or hash table variables, they store the values in shared memory. Moreover, avp/xavp are associated with the suspended transaction and available after continue as they were at suspend time.</p>
<p>Execution jumps to a route block, so whatever you want to have in the same route block after suspend, move to a dedicated route block. Of course, returning in the execution stack done before suspend doesn't work.</p>
<p>But this is something that is specific to parallel processing, the reason for share memory to exist as a concept. Same is also with multi-threading, no share memory because threads work all with same private memory, but there are variables on the stack as well as thread context. You can find many libc functions that have the <code>thread safe</code> version, so they require a stack variable or a context.</p>
<p>Even in other programming languages, all async functions require a callback to be provided, which is executed when async task is completed, and as part of globals (shared memory), the rest of variables before async exec are not available.</p>
<p>In short, this is what technology does right now (at least in C), if I am mistaken and someone has solutions, I will be happy to hear and learn.</p>
<p>I am closing this one, if you want to discuss more about this topic, or how to leverage avp/xavp/htable to pass info from suspend time to continue time, should be done on sr-users mailing list.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you commented.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1642#issuecomment-421907460">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36Ze9oUPj1wDyZzO7MI2pxPzHuZiJPks5ub0crgaJpZM4Wnp61">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36Zd4hb83-CZOx9KkQbV3Va6fUrJweks5ub0crgaJpZM4Wnp61.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1642: Use avp, xavp or hash table variables, they store the values in shared memory. Moreover, avp/xavp are associated with the suspended transaction and available after continue as they were at suspend time.\r\n\r\nExecution jumps to a route block, so whatever you want to have in the same route block after suspend, move to a dedicated route block. Of course, returning in the execution stack done before suspend doesn't work.\r\n\r\nBut this is something that is specific to parallel processing, the reason for share memory to exist as a concept. Same is also with multi-threading, no share memory because threads work all with same private memory, but there are variables on the stack as well as thread context. You can find many libc functions that have the `thread safe` version, so they require a stack variable or a context.\r\n\r\nEven in other programming languages, all async functions require a callback to be provided, which is executed when async task is completed, and as part of globals (shared memory), the rest of variables before async exec are not available.\r\n\r\nIn short, this is what technology does right now (at least in C), if I am mistaken and someone has solutions, I will be happy to hear and learn.\r\n\r\nI am closing this one, if you want to discuss more about this topic, or how to leverage avp/xavp/htable to pass info from suspend time to continue time, should be done on sr-users mailing list."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1642#issuecomment-421907460"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1642#issuecomment-421907460",
"url": "https://github.com/kamailio/kamailio/issues/1642#issuecomment-421907460",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [kamailio/kamailio] Feature request: http_async_query response route to resume execution from memory (#1642)",
"sections": [
{
"text": "",
"activityTitle": "**Daniel-Constantin Mierla**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@miconda",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1642,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1642#issuecomment-421907460"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 379494069\n}"
}
],
"themeColor": "26292E"
}
]</script>