Questions tagged [locks]

A lock generally refers to something that prevents another process from starting or accessing the same information until the lock is released. Use with an appropriate language tag. Do not use for physical locks.

433 questions
0
votes
1 answer

Why would removing locks reduce errors in Helgrind?

I'm doing my first parallel programming assignment and have very little idea what I'm doing with the whole mutex locking situation. I'm trying to use Helgrind to locate race conditions in my code, and when I have locks where I think they should be,…
Jason Block
  • 155
  • 1
  • 3
  • 9
0
votes
2 answers

ios allow a specific number of threads on using a method at the same time

I understand that @synchronized(self) { /* lock is effective inside here only */ } can keep multiple threads from accessing your method at the same time. So no one will be able to access what's inside the @synchronized{} while it is being…
Glenn S
  • 697
  • 9
  • 21
0
votes
1 answer

What is the best way to increase number of locks?

This question is based on Synchronizing on an Integer results in NullPointerException and originated from this question Synchronizing on an Integer value I wanted to know what is the best way to increase number of locks in Java. Other than which is…
Amit Deshpande
  • 19,001
  • 4
  • 46
  • 72
0
votes
0 answers

Waiting to acquire read lock on a previously updated row within the same transaction

within a transaction with read committed isolation level if you do an update on a set of rows and then do a select on the same set of rows will sql server not reuse the x locks it acquires on the index when doing the update to do the next select or…
nams
  • 63
  • 5
0
votes
2 answers

@synchronized vs lock/unlock

I'm new to Objective-C. When should I used @synchronized, and when should I use lock/unlock? My background is mainly in Java. I know that in Java, obtaining explicit-locks allows you to do more complex, extensive, and flexible operations (vis-à-vis…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
0
votes
1 answer

mysql innodb lock

I am developing application that will run from multiple comuters. I want to lock mysql tables, so there won't be process concurrency issues, like one process is writing and other process is reading at the same time. Or what is even worse both…
Milos Ljumovic
  • 403
  • 4
  • 16
0
votes
2 answers

EJB 3.1 Transaction propagation

I have 3 EJB stateless beans. A - on business layer. B, C - of persistence layer. Bean A calls B and C to update some data in database (DB2). But unfortunatly, on calling bean C, database locks. Is it possible that B and C executes in defferent…
obogoliy
  • 31
  • 4
0
votes
1 answer

Using & Creating threads in wxwdigets in c++ on windows

I was reading related to the cration of threads using wxwidgets in c++ on windows however i am not able to understand the what the following snippet of the code means:- the following things are a part of the project:- Myfirm.cpp My thread.h …
0
votes
2 answers

What happens to the lock in the following situation, when cond is true?

I have this code ,now can anyone reply s what happens to the lock in the following situation considering that cond is true:- for (;;) { static mutex m; Lock lock(m); if (cond) break; ... } Thanks
-1
votes
2 answers

Java Locks synchronize methods baking transfer

Hello I have a Java application that takes an input number of operations to perform and it run different threads for each operation: //create operations to execute Thread t[] = new Thread [n_operations]; //we create a Bank with N accounts Bank…
nuvio
  • 2,555
  • 4
  • 32
  • 58
-1
votes
1 answer

How to avoid data leakage and thread blocking while writing data on a file on android

I'm working with android sensors and have a method inside a listener that keeps appending data on a string builder with really high frequency. After some data is collected I compress the string with gzip and write it on a file to avoid out of memory…
Chris_Gr
  • 5
  • 4
-1
votes
2 answers

runtime.futex taking 50% to 70% time in go profile

As part of profiling couple of golang services we are seeing that all the services are spending 55% to 70% time in the runtime.futex function. Note that these services involve use of goroutines, locks, and channels for synchronization and…
NNK
  • 49
  • 2
-1
votes
1 answer

How to lock files in Java RMI?

I'm implementing a quick file server using Java RMI, which has 2 remote methods, one is for reading a file from the server and the other is for writing it to the client. I want to lock concurrent access to same file. For example, if 10 users…
Juan
  • 9
  • 2
-1
votes
3 answers

C# string becoming empty

Relatively new to C# and coding in general (first post here). I have a WinForms local application where some information is displayed to the user in a ReadOnly(true) RichTextBox. Almost all my classes need to send information to that RichTextBox. To…
Laurent
  • 7
  • 2
-1
votes
1 answer

C# Locking object for threads only in certain cases

Say I have two threads I want to be able to access an object, but not if a third thread is using it (and vice versa). What I can do is use 2 locks: Thread A: lock(object1) { // do work } Thread B: lock(object2) { // do work } Thread…
Maverick Meerkat
  • 5,737
  • 3
  • 47
  • 66
1 2 3
28
29