0

I am using NSPR as my cross-platform threading library and using these locks: PRLock and PRRWLock. I want a timeout in the lock functions. So that, it should wait for 45 seconds, and if it is not able to acquire a lock within that time, the call should come out with an error.

Then we can report error to the user within 45 seconds.

How can I do it?

Actually I am doing some SQLite operation inside a lock, and sometimes that take long time to complete, if the database is large (~1.9 GB). I want to come up with error to the user that time, if acquiring lock fails. Please help.

Sabya
  • 11,534
  • 17
  • 67
  • 94

1 Answers1

1

I have not used this lib myself but most waits usually have a time out.

But as I checked the doc real quick I found this for PRLock "Acquiring the lock is not an interruptible operation, nor is there any timeout mechanism.".

Link

shilovk
  • 11,718
  • 17
  • 75
  • 74
Fredrik Jansson
  • 3,764
  • 3
  • 30
  • 33