In SQL Server, how can I lock a single row in a way similar to Oracle’s “SELECT FOR UPDATE WAIT”?

You’re probably looking forwith (updlock, holdlock). This will make a select grab an exclusive lock, which is required for updates, instead of a shared lock. The holdlock hint tells SQL Server to keep the lock until the transaction ends. FROM TABLE_ITEM with (updlock, holdlock)

Under which circumstances does the System process (PID 4) retain an open file handle?

Files accessed through a share will be locked by the system process (PID 4). Try opening compmgmt.msc -> System Tools -> Shared Folders -> Open Files to see if the locked file is listed there See also the sysinternals forum for a way to replicate this. Not all applications lock files when they are opened, … Read more

increment a count value outside parallel.foreach scope

I like to beat dead horses! 🙂 The “lightest” way to increment the count from multiple threads is: Interlocked.Increment(ref count); But as others have pointed out: if you’re doing it inside Parallel.ForEach then you’re probably doing something wrong. I’m suspecting that for some reason you’re using ForEach but you need an index to the item … Read more

How to use lock in OpenMP?

You want the OMP_SET_LOCK/OMP_UNSET_LOCK functions: https://hpc.llnl.gov/tuts/openMP/#OMP_SET_LOCK Basically: omp_lock_t writelock; omp_init_lock(&writelock); #pragma omp parallel for for ( i = 0; i < x; i++ ) { // some stuff omp_set_lock(&writelock); // one thread at a time stuff omp_unset_lock(&writelock); // some stuff } omp_destroy_lock(&writelock); Most locking routines such as pthreads semaphores and sysv semaphores work on that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)