Search Results

Search found 3765 results on 151 pages for 'matthew lock'.

Page 13/151 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • lock file so that it cannot be deleted

    - by JoeCool
    I'm working with two independent c/c++ applications on Windows where one of them constantly updates an image on disk (from a webcam) and the other reads that image for processing. This works fine and dandy 99.99% of the time, but every once in a while the reader app is in the middle of reading the image when the writer deletes it to refresh it with a new one. The obvious solution to me seems to be to have the reader put some sort of a lock on the file so that the writer can see that it can't delete it and thus spin-lock on it until it can delete and update. Is there anyway to do this? Or is there another simple design pattern I can use to get the same sort of constant image refreshing between two programs? Thanks, -Robert

    Read the article

  • Oracle transaction read-consistency ?

    - by trojanwarrior3000
    I have problem understanding read consistency in db(oracle). Suppose I am manger of a bank . A customer has got lock (which I dont know) and is doing some updation. Now after he has got lock I am viewing account info of the same customer and try to do some thing on it.But because of read consistency I will see data as it existed before customer got the lock. So will not that affect inputs I am getting and the decisions that I am gonna make during that period?

    Read the article

  • Determining threshold for lock escalation

    - by Davin
    I have a table with around 2.5 millions records and will be updating around 700k of them and want to update these while still allowing other users to see the data. My update statement looks something like this: UPDATE A WITH (UPDLOCK,ROWLOCK) SET A.field = B.field FROM Table_1 A INNER JOIN Table2 B ON A.id = B.id WHERE A.field IS NULL AND B.field IS NOT NULL I was wondering if there was any way to work out at what point sql server will escalate a lock placed on an update statement (as I don't want the whole table to be locked)? I don't have permissions to run a server trace to see how the locks are being applied, so is there any other way of knowing at what point the lock will be escalated to cover the whole table? Thanks!

    Read the article

  • How to set timeout for exclusive lock in PostgreSQL

    - by Low Kian Seong
    I have an import script that was failing because of the 'Exclusive nowait' option I set my script. This caused the script to error out the first time it could not get the exclusive lock on the table. My script did it this way: "LOCK TABLE %s IN EXCLUSIVE MODE NOWAIT" Now my script works it's just that I want to be able to set the timeout for PostgreSQL instead of having it wait for the maximum time which is 15mins. I prefer to set it in posgresql.conf. Is there a way to do this?

    Read the article

  • How to ensure I can replace files in a directory?

    - by chaiguy
    I want to completely replace one directory on the file system with another directory in a temp directory. The tricky part is that the files in the folder to be replaced could be being used at any time, causing the replace operation to fail. I need to somehow wait on an exclusive lock on the directory so that I can delete all of its contents without failing, so I can then move the other directory in to replace it. To make matters potentially more difficult, the process that is likely to be using the files is my own (via a Lucene.net library and out of my hands). So it can't be a process-level lock it has to be an object-level lock. Any thoughts on how I might do this? Or should I just keep re-attempting until it succeeds? I guess that's always an option.

    Read the article

  • Lucene .NET IndexWriter lock

    - by Pini Salim
    My question related to the next code snippet: static void Main(string[] args) { Lucene.Net.Store.Directory d = FSDirectory.Open(new DirectoryInfo(/*my index path*/)); IndexWriter writer = new IndexWriter(d, new WhitespaceAnalyzer()); //Exiting without closing the indexd writer... } In this test, I opened an IndexWriter without closing it - so even after the test exits, the write.lock file still exists in the index directory, so I expected that the next time I open an instance of IndexWriter to that index, a LockObatinFailedException will be thrown. Can someone please explain to me why am I wrong? I mean, does the meaning of the write.lock file is to protect creation of two IndexWriters in the same process only? that doesnt seems the right answer to me...

    Read the article

  • Run Oracle Procedure just to lock row, without returning a resultset

    - by Pascal
    I want to run a procedure to force a row lock on a row, but I don't want to return a result set to the client, nor do I actually want to update anything. Below is the proc: CREATE OR REPLACE PROCEDURE SP_LOCK_Row (IDRow IN INTEGER) IS BEGIN SELECT * FROM TBLTable WHERE IDRow = IDRow FOR UPDATE; END; The problem is that I keep getting the error: PLS-00428: an INTO clause is expected in this SELECT statement. Is there a way for me to lock the row without actually having to return a result set back to the client? The SQL Server equivalent is: CREATE PROCEDURE dbo.SP_LOCK_Row( @IDRow INT) AS SELECT * FROM dbo.TBLTable WITH (UPDLOCK, ROWLOCK) WHERE IDRow = @IDRow Tks

    Read the article

  • Display CFUserNotification on iPhone lock screen

    - by user1768826
    I am developing an iPhone app that need to display some message on lock screen. I have tried to use local notification or CFUserNotification but neither of them can display the message on top of the lock screen. For CFUserNotification I have tried kCFUserNotificationAlertTopMostKey (refer this similar question) but it still not work. I am not going to hook springboard since my phone is not jailbreak. I have found an app do implement it and I have tested on my none-jailbreak iPhone iOS 6.0, don't know how to implement this. Any help much appreciated.

    Read the article

  • Fixed strptime exception with thread lock, but slows down the program

    - by eWizardII
    I have the following code, which when is running inside of a thread (the full code is here - https://github.com/eWizardII/homobabel/blob/master/lovebird.py) for null in range(0,1): while True: try: with open('C:/Twitter/tweets/user_0_' + str(self.id) + '.json', mode='w') as f: f.write('[') threadLock.acquire() for i, seed in enumerate(Cursor(api.user_timeline,screen_name=self.ip).items(200)): if i>0: f.write(", ") f.write("%s" % (json.dumps(dict(sc=seed.author.statuses_count)))) j = j + 1 threadLock.release() f.write("]") except tweepy.TweepError, e: with open('C:/Twitter/tweets/user_0_' + str(self.id) + '.json', mode='a') as f: f.write("]") print "ERROR on " + str(self.ip) + " Reason: ", e with open('C:/Twitter/errors_0.txt', mode='a') as a_file: new_ii = "ERROR on " + str(self.ip) + " Reason: " + str(e) + "\n" a_file.write(new_ii) break Now without the thread lock I generate the following error: Exception in thread Thread-117: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 530, in __bootstrap_inner self.run() File "C:/Twitter/homobabel/lovebird.py", line 62, in run for i, seed in enumerate(Cursor(api.user_timeline,screen_name=self.ip).items(200)): File "build\bdist.win-amd64\egg\tweepy\cursor.py", line 110, in next self.current_page = self.page_iterator.next() File "build\bdist.win-amd64\egg\tweepy\cursor.py", line 85, in next items = self.method(page=self.current_page, *self.args, **self.kargs) File "build\bdist.win-amd64\egg\tweepy\binder.py", line 196, in _call return method.execute() File "build\bdist.win-amd64\egg\tweepy\binder.py", line 182, in execute result = self.api.parser.parse(self, resp.read()) File "build\bdist.win-amd64\egg\tweepy\parsers.py", line 75, in parse result = model.parse_list(method.api, json) File "build\bdist.win-amd64\egg\tweepy\models.py", line 38, in parse_list results.append(cls.parse(api, obj)) File "build\bdist.win-amd64\egg\tweepy\models.py", line 49, in parse user = User.parse(api, v) File "build\bdist.win-amd64\egg\tweepy\models.py", line 86, in parse setattr(user, k, parse_datetime(v)) File "build\bdist.win-amd64\egg\tweepy\utils.py", line 17, in parse_datetime date = datetime(*(time.strptime(string, '%a %b %d %H:%M:%S +0000 %Y')[0:6])) File "C:\Python27\lib\_strptime.py", line 454, in _strptime_time return _strptime(data_string, format)[0] File "C:\Python27\lib\_strptime.py", line 300, in _strptime _TimeRE_cache = TimeRE() File "C:\Python27\lib\_strptime.py", line 188, in __init__ self.locale_time = LocaleTime() File "C:\Python27\lib\_strptime.py", line 77, in __init__ raise ValueError("locale changed during initialization") ValueError: locale changed during initialization The problem is with thread lock on, each thread runs itself serially basically, and it takes way to long for each loop to run for there to be any advantage to having a thread anymore. So if there isn't a way to get rid of the thread lock, is there a way to have it run the for loop inside of the try statement faster?

    Read the article

  • MySQL Locks: order of unblocked threads

    - by teehoo
    I have a MySQL ISAM table being accessed my multiple php instances. Right now I'm using a WRITE lock to serialize access to this table. My question is how do I ensure that the PHP instances get served on a First-Come-First-Serve basis? Or is this the default behaviour? The official MySQL documentation doesn't mention anything about the blocked thread order for threads of the same lock type (ie multiple threads attempting a WRITE LOCK). It only mentions that a WRITER will jump to the front of the waiting queue if READERS are waiting.

    Read the article

  • Get notified when some other application acquires wake lock

    - by Sebouh
    I am wondering if the following is possible in android. I want to have my application do a certain task whenever the phone get awoken. Whenever some other application acquires a wake lock to do it's task, I want my application to do something of its own. Can I get notified through an intent using a broadcast receiver about this event? If so, what will happen if that other application finishes before my task ends? The reason I'm asking is that I don't want to wake the phone up to do my task and affect the battery life. I want to take the opportunity of the wake lock to do my thing.

    Read the article

  • Computer keeps locking me out

    - by me32
    When I'm away from my computer (Windows XP) for more than ~30 minutes, I get locked out, and have to press Ctrl+Alt+Delete to login. I've checked the screensaver settings, and it's not set to lock the screen. Does anyone know what else could be causing this? Thanks

    Read the article

  • How to achieve syncronization in loadbalanced multiserver environment

    - by Anoop
    Hi, I have to create a .net web application which would run on more than one front end server which are load balanced. Now I have to use some third party api which is not thread safe so only one thread should call the API at a time so I have to some use syncronization machanism like lock or mutex which provide syncronisation within the process and across the process in machine.Now will lock or mutex work in loadbalanced multiserver environment correctly? If not then is there any mechanism using which I can syncronise all the threads in all the machines??

    Read the article

  • [C#] Lock a file and avoid readings while it's writing

    - by vtortola
    Hi, My web application returns a file from the filesystem. These files are dynamic, so I have no way to know the names o how many of them will there be. When this file doesn't exist, the application creates it from the database. I want to avoid that two different threads recreate the same file at the same time, or that a thread try to return the file while other thread is creating it. So I want to lock a file till its recreation is complete, if other thread try to access it ... it will have to wait the file be unlocked. I've been reading about FileStream.Lock, but I have to know the file length and it won't prevent that other thread try to read the file, so it doesn't work for my particular case. I've been reading also about FileAccess.None, but it will throw an exception (which exception type?) if other thread/process try to access the file... so I should develop a "try again while is faulting" ... and I don't like too much that approach, although maybe there is not a better way. How could I archieve this? Kind regards.

    Read the article

  • How to Lock a file and avoid readings while it's writing

    - by vtortola
    My web application returns a file from the filesystem. These files are dynamic, so I have no way to know the names o how many of them will there be. When this file doesn't exist, the application creates it from the database. I want to avoid that two different threads recreate the same file at the same time, or that a thread try to return the file while other thread is creating it. So I want to lock a file till its recreation is complete, if other thread try to access it ... it will have to wait the file be unlocked. I've been reading about FileStream.Lock, but I have to know the file length and it won't prevent that other thread try to read the file, so it doesn't work for my particular case. I've been reading also about FileAccess.None, but it will throw an exception (which exception type?) if other thread/process try to access the file... so I should develop a "try again while is faulting" ... and I don't like too much that approach, although maybe there is not a better way.

    Read the article

  • Lucene.net create+lock errors in ASP.NET

    - by acidzombie24
    I have an issue with Lucene.net. It throws a lock exception. After poking around i notice these things. My code below works in an app bit when calling in Application_Start i get a NoSuchDirectoryException. Not closing the writer (as my code doesnt do below) i WILL get a LockObtainFailedException with the message Lock obtain timed out: SimpleFSLock@<FULL_PATH> from either app or asp.net These thread hinted when spawning threads they get less permissions then i do (but! my main thread has problems as well...) and one solution is to impersonate IIS. I am using visual studios 2010. I am not sure how full blown it is but my attempt to impersonate it failed. So my question is how do i have lucene create the directory and not throw an exception if dont close the writer for some reason (such as power going out)? http://stackoverflow.com/questions/2341163/why-is-my-lucene-index-getting-locked/2499285#2499285 http://stackoverflow.com/questions/1123517/lucene-net-and-i-o-threading-issue/1123981#1123981 static IndexWriter writer = null; static void lucene_init() { bool create = false; string dirname = "LuceneIndex_z"; if (System.IO.Directory.Exists(dirname) == false) create = true; var directory = FSDirectory.GetDirectory(dirname); var analyzer = new StandardAnalyzer(); writer = new IndexWriter(directory, analyzer, create); }

    Read the article

  • Lucene.net create+lock errors in ASP.NET

    - by acidzombie24
    I have an issue with Lucene.net. It throws a lock exception. After poking around i notice these things. My code below works in an app bit when calling in Application_Start i get a NoSuchDirectoryException. Not closing the writer (as my code doesnt do below) i WILL get a LockObtainFailedException with the message Lock obtain timed out: SimpleFSLock@<FULL_PATH> from either app or asp.net These thread hinted when spawning threads they get less permissions then i do (but! my main thread has problems as well...) and one solution is to impersonate IIS. I am using visual studios 2010. I am not sure how full blown it is but my attempt to impersonate it failed. So my question is how do i have lucene create the directory and not throw an exception if dont close the writer for some reason (such as power going out)? http://stackoverflow.com/questions/2341163/why-is-my-lucene-index-getting-locked/2499285#2499285 http://stackoverflow.com/questions/1123517/lucene-net-and-i-o-threading-issue/1123981#1123981 static IndexWriter writer = null; static void lucene_init() { bool create = false; //I now use a full path. I still get NoSuchDirectoryException //string dirname = "LuceneIndex_z"; if (System.IO.Directory.Exists(dirname) == false) create = true; var directory = FSDirectory.GetDirectory(dirname); var analyzer = new StandardAnalyzer(); writer = new IndexWriter(directory, analyzer, create); }

    Read the article

  • OpenGL Calls Lock/Freeze

    - by Necrolis
    I am using some dell workstations(running WinXP Pro SP 2 & DeepFreeze) for development, but something was recenlty loaded onto these machines that prevents any opengl call(the call locks) from completing(and I know the code works as I have tested it on 'clean' machines, I also tested with simple opengl apps generated by dev-cpp, which will also lock on the dell machines). I have tried to debug my own apps to see where exactly the gl calls freeze, but there is some global system hook on ZwQueryInformationProcess that messes up calls to ZwQueryInformationThread(used by ExitThread), preventing me from debugging at all(it causes the debugger, OllyDBG, to go into an access violation reporting loop or the program to crash if the exception is passed along). the hook: ntdll.ZwQueryInformationProcess 7C90D7E0 B8 9A000000 MOV EAX,9A 7C90D7E5 BA 0003FE7F MOV EDX,7FFE0300 7C90D7EA FF12 CALL DWORD PTR DS:[EDX] 7C90D7EC - E9 0F28448D JMP 09D50000 7C90D7F1 9B WAIT 7C90D7F2 0000 ADD BYTE PTR DS:[EAX],AL 7C90D7F4 00BA 0003FE7F ADD BYTE PTR DS:[EDX+7FFE0300],BH 7C90D7FA FF12 CALL DWORD PTR DS:[EDX] 7C90D7FC C2 1400 RETN 14 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C the messed up function + call: ntdll.ZwQueryInformationThread 7C90D7F0 8D9B 000000BA LEA EBX,DWORD PTR DS:[EBX+BA000000] 7C90D7F6 0003 ADD BYTE PTR DS:[EBX],AL 7C90D7F8 FE ??? ; Unknown command 7C90D7F9 7F FF JG SHORT ntdll.7C90D7FA 7C90D7FB 12C2 ADC AL,DL 7C90D7FD 14 00 ADC AL,0 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C So firstly, anyone know what if anything would lead to OpenGL calls cause an infinite lock,and if there are any ways around it? and what would be creating such a hook in kernal memory ? Update: After some more fiddling, I have discovered a few more kernal hooks, a lot of them are used to nullify data returned by system information calls(such as the remote debugging port), I also managed to find out the what ever is doing this is using madchook.dll(by madshi) to do this, this dll is also injected into every running process(these seem to be some anti debugging code). Also, on the OpenGL side, it seems Direct X is fine/unaffected(I ran one of the DX 9 demo's without problems), so could one of these kernal hooks somehow affect OpenGL?

    Read the article

  • Using SQL dB column as a lock for concurrent operations in Entity Framework

    - by Sid
    We have a long running user operation that is handled by a pool of worker processes. Data input and output is from Azure SQL. The master Azure SQL table structure columns are approximated to [UserId, col1, col2, ... , col N, beingProcessed, lastTimeProcessed ] beingProcessed is boolean and lastTimeProcessed is DateTime. The logic in every worker role is: public void WorkerRoleMain() { while(true) { try { dbContext db = new dbContext(); // Read foreach (UserProfile user in db.UserProfile .Where(u => DateTime.UtcNow.Subtract(u.lastTimeProcessed) > TimeSpan.FromHours(24) & u.beingProcessed == false)) { user.beingProcessed = true; // Modify db.SaveChanges(); // Write // Do some long drawn processing here ... ... ... user.lastTimeProcessed = DateTime.UtcNow; user.beingProcessed = false; db.SaveChanges(); } } catch(Exception ex) { LogException(ex); Sleep(TimeSpan.FromMinutes(5)); } } // while () } With multiple workers processing as above (each with their own Entity Framework layer), in essence beingProcessed is being used a lock for MutEx purposes Question: How can I deal with concurrency issues on the beingProcessed "lock" itself based on the above load? I think read-modify-write operation on the beingProcessed needs to be atomic but I'm open to other strategies. Open to other code refinements too.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >