Questions tagged [shared]

In VB.NET, the Shared keyword is roughly equivalent to the static keyword used by many other languages.

In , the Shared keyword is roughly equivalent to the static keyword used by and many other languages.

For example, the following code snippet in VB.NET:

Public Class Foo
    Public Shared Bar As String
End Class

Is equivalent to the C#:

public class Foo
{
    public static string Bar;
}

Further Reading

OpenMP

In OpenMP, it corresponds to the status of a variable. In a parallel section, a SHARED variable will be shared by all the running threads, meaning they will all access this variable and could modify it simultaneously. It is the default status of every variable in a parallel section, apart from the iteration counters.

1404 questions
-1
votes
2 answers

Storing/Retrieving Data with Shared Preferences

I have an application with 7 separate views. In each of those views there is an option to answer a 'yes' or 'no.' We are trying to save these 'yes' or 'no' values using shared preferences. Then, we want to have a new view/layout and be able to call…
-1
votes
1 answer

Why am I getting a segmentation-fault?

This is my code: struct bacchetta { bool in_uso; }; int main() { key_t key; if ((key = ftok(".", 'a')) == -1) { perror("ftok"); exit(1); } int shmid; if ((shmid = semget(key, sizeof(struct bacchetta)*5, 0600 | IPC_CREAT )) ==…
Francesco Bonizzi
  • 5,142
  • 6
  • 49
  • 88
-1
votes
2 answers

create database with no cpanel access

I have an installation script, it works fine on localhost but on a share hosting I always get "access denied", below is the installation script mysql code. its really weird how it only works locally on localhost. if(isset($_POST['install']))…
-1
votes
1 answer

how to make a process shared memory (c, linux)?

I have a process that dived itself with fork. I need to create a region of memory (a matrix) for the result of the computation of each process. How can I do this? Everything I tried or I can use but it's not shared between processes or I can't use…
Erik Scheffer
  • 101
  • 1
  • 2
  • 7
-1
votes
1 answer

VBS code to access the shared excel one user at a time

I have 1. A shared excel sheet 2. Html page with VBscript I want to execute a part of code(saving some data in shared excel) such that only one user (the one who opened that shared excel first) at a time can do it. I trying many things. But its…
Anurag Rana
  • 1,429
  • 2
  • 24
  • 48
-1
votes
1 answer

Kohana Controller actions share variable

I want write one variable to access any action into same controller. I write one shared or global variable. I using, Kohana 3.1. It's possible !? I don't find any example or people with same question.
-1
votes
1 answer

How to import/link shared xCode project (and be able to edit shared project from any client)?

I don't want to compile shared project to any kind of library. I just want to use existing classes like they would integral part of client project. I want to edit/develop/improve the shared project from any client project that use it. I've ran…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
-1
votes
4 answers

How to use shared Preferences on Android?

I am creating a very simple application that only has a seek bar that the user can use. My code looks like this : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
donparalias
  • 1,834
  • 16
  • 37
  • 60
-2
votes
3 answers

Android: unable to read from sharedpreferences

So i have a slight problem. I have a feeling its something simple that i must be overlooking. In my second fragment im writing to sharedpreferences a certain number of keys and applying() afterwords. After i have finished writing my data to the…
-2
votes
2 answers

How to create a shared class and use it in another classes in swift

I need to use a shared class for my new project for reusing objects and functions in swift .I also need to know how this can be used in another classes. Thanks in Advance Berry
-2
votes
1 answer

C++ shared_ptr how to ensure thread safety?

all: According to this page c++ implementations typically uses atomic ref count to ensure thread safety, but this seems buggy in some cases. ``` void func2(shared_ptr* x) { shared_ptr a(*x); *a += 1; } thread func1() { …
Liu Renjie
  • 220
  • 2
  • 11
-2
votes
2 answers

Setting shared values in a for/next loop

I have a shared array that needs a calculation for each index. Right now, the array is initialized in New() and executes each time an object is created, which is redundant. How can I set it up so that the array is only initialized once, when it is…
Tom K
  • 321
  • 1
  • 4
  • 15
-2
votes
3 answers

Python class variables scope not as per documentation

As per documentation: "Generally speaking, instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class" >>> class Dog: ... kind='canine' ... ... def…
Tarik
  • 10,810
  • 2
  • 26
  • 40
-2
votes
1 answer

CUDA: Using data from cache to access local variable?

A kernel with a shared array and a couple of local ints: __global__ void myKern() { gloablID = ....; //initialize gloabl thread ID __shared__ int TMS[3]; //populate shared array in a simple way if (globalID == 0) { TMS[0] = 0; TMS[1]…
Jordan
  • 305
  • 3
  • 13
-2
votes
3 answers

Cannot obtain shared variable value in separate threads

My program has a server thread and separate client threads that are individual connections to other servers. So how my program works is the client threads make individual requests, and when each of them so, I increment the shared variable…
leba-lev
  • 2,788
  • 10
  • 33
  • 43
1 2 3
93
94