Questions tagged as 'thread-safety'

4
answers

How to use SimpleDateFormat in competing environments?

The class SimpleDateFormat is not thread safe . I recently had problems with instances of class SimpleDateFormat in static context being used by multiple threads concurrently in a web application. private static final DateForm...
asked by 11.12.2013 / 20:55
2
answers

Is it safe to use List with Parallel.ForEach?

I'm doing a doing a crawler style method that takes a string list, makes a call to a website, inserts the return into another list, and returns. My method is working, but it is very slow so I want to parallelize the calls. I searched for...
asked by 18.05.2016 / 23:40
2
answers

Keyword for C # equivalent to "synchronized" Java

Problem I'm implementing a connection manager that implements the standard Singleton , managing a pool of single-key connections for each new connection. So I'm trying to get problems with the parallelism of my manager, because it can be c...
asked by 17.08.2016 / 13:53
1
answer

Access object of a method executed by thread in the background in C # with WinForms

I created a thread to execute a process that takes a lot of time and makes the application process stop for a very long time private void ExeConsultaClientes() { thread = new Thread(new ThreadStart(ExeConsultaClientesst));...
asked by 09.03.2018 / 15:02
1
answer

Initialize and change static variable in a safe way. Does this code make sense? Intellij IDEA thinks it does not

Hello I'm looking for a secure way to initialize and change a static variable that will be shared by different threads that will be accessing its value. The idea is that at some point I will check that this variable needs to be changed a...
asked by 13.06.2018 / 15:00
1
answer

Python asyncio and threading

I am studying the module asyncio of Python and there is the function run_coroutine_threadsafe which should be run on a thread other than the event loop. Here's my script: #!usr/bin/python3 # -*- coding: utf-8 -*- import asyn...
asked by 15.08.2018 / 02:53
1
answer

Update_All Rails with field of the database itself

I need to make a change in all the columns of the database by replicating information from another column, for example: Model.update_all("a = b") I would like to create threads and start spinning, for example at midnight, and finishing at...
asked by 03.11.2016 / 20:37