Questions tagged [shared-variable]

A shared-variable is used within multi-threaded software as the name implies; a variable that is shared between threads and in the context of thread safety and using mutexes in mind.

A variable that is to be used by multiple threads or processes. For instance, a variable that can be read by one thread and written to by another within the same program.

42 questions
183
votes
6 answers

multiprocessing: How do I share a dict among multiple processes?

A program that creates several processes that work on a join-able queue, Q, and may eventually manipulate a global dictionary D to store results. (so each child process may use D to store its result and also see what results the other child…
dop
  • 1,831
  • 2
  • 12
  • 3
5
votes
2 answers

Python: Why is the multiprocessing lock shared among processes here?

I am trying to share a lock among processes. I understand that the way to share a lock is to pass it as an argument to the target function. However I found that even the approach below is working. I could not understand the way the processes are…
gdRow
  • 497
  • 1
  • 5
  • 10
4
votes
1 answer

Sharing a Native variable between Delphi Threads

I was assuming that if a shared variable between threads has native type, atomicity should do the job. But as per output of the code below, it is not the case, at least for delphi. Thread t1 is simply incrementing the counter 10M times. At the same…
Mehmet Fide
  • 1,643
  • 1
  • 20
  • 35
3
votes
1 answer

Share variables between steps in drone.io

It seems to me that drone.io does not share parameters across pipeline steps. Is it possible to read the parameters for the plugins from a file, e.g. a directive like "from_file" similar to the already existing "from_secret"? This is how one could…
Maximilian Mordig
  • 1,333
  • 1
  • 12
  • 16
2
votes
1 answer

Base table or view not found laravel - Running scheduler cron

while running php artisan eventnotification:mail in command, it throws below error "SQLSTATE[42S02]: Base table or view not found: 1146 Table " My appserviceprovider.php public function boot() { $rolesList = $this->getRolesList(); …
2
votes
1 answer

Python multiprocessing: How to use shared variable for a list of a complex class?

When using multiprocessing in Python, I hope to make a list of a class as a shared variable. The class can be seen as follows(simplified): class testClass(): def __init__(self): self.a = [] self.b = [] Then, I use multiprocessing to process…
Tianqing
  • 21
  • 1
2
votes
3 answers

Threading with shared variables

I tried to use multiple threads to insert into a boost::bimap. I have some shared variable between the threads, which I need to pass by reference and some of them are modified by each thread execution. However, I get the error: Segmentation fault…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
1
vote
1 answer

Running two function together with multiprocessing and share variables

i used multiprocessing but i don't know how to do it the logic : a variable sign is equal to 0, with a function called timer count 20 seconds and each second check if sign is equal to 1 then it'll print something and breaks the loop, at the same…
1
vote
2 answers

How to import a python file to multiple files of a module with them not using the same variables?

I have a python file, let's say it is common.py In this, I have some functions, and a variable which is needed for the functions: TAG = '[TESTTAG]' def myprint(obj): print(f'{TAG} {obj}') def set_tag(out_tag): global TAG TAG =…
1
vote
1 answer

how to share data between django server and python websocket server

I am writing a web app with Django in which I have to share some data with another python socket server running in parallel. I have tried using a common python file to store global variable. but since those server are two different processes it is…
Usama
  • 159
  • 1
  • 13
1
vote
1 answer

How to share variables among threads?

I am working on a server-client project which allows the server to exchange messages with a client individually. However, I have to modify the server so that when the server sends a message, it is sent to all connected clients. I know this involves…
1
vote
1 answer

Pass JSON to Dynamics CRM SharedVariable instead of string

I have data which is serialized as JSON which then has to be added to the Dynamics PluginExeutionContext in a SharedVariable. The Problem is that the JSON content is passed as string and cannot be parsed as JSON on the other side of the…
1
vote
0 answers

Makefile variable shared between custom packages for openwrt

While adding custom packages, package A is using Makefile variable that needs to be updated (or not) by other package B, however package B is not mandatory for compiling package A. In other words, if configuration selects package B in that case…
mqm
  • 11
  • 1
1
vote
2 answers

Shared variables in oracle apex

I am a beginner to Oracle Apex and I am using version 19.1. How do I create/use shared variables? I want to set/access them through different pages. I am not able to figure this out since everything is provided with an interface and not much access…
Rutuja Kulkarni
  • 67
  • 1
  • 1
  • 5
1
vote
1 answer

Multiprocessing Shared Variables

Although this question seems very repetitive, I definitely don't know what may I doing wrong. The following example provided by Python docs and many others I have tried, are totally ignoring target function variable setting. I'm running it on Python…
1
2 3