Hi,
Its not reinventing wheels. I tried to put the problem statement in simple
words. Description of the platform and the problem may not be suitable here.

Well i would not agree with the timeout. Library will run in context of the
application. A crash in application will mean the timer also exits.
Application can hold the lock indefinitely as long as it is active. Suppose
a application is playing a video file. It locks the video file. And just
before graceful exit it unlocks it. But if it crashes in the middle of play
the lock is still active.

The device is programmed to unlock on reboot. We are to find a solution
where you can solve this. I could think of the following but it has a back
drop.
1) A log file maintains the lock status and the PID of app having that lock
2) New applications will check for the lock status, if unlocked will get the
lock and update the PID value.
3) If its locked then it will check for the PID value and check if that PID
is alive. If not alive will forcefull unlock .

The problem would be the OS will issue PID in round robin manner. Suppose
application will PID 1 terminates abnormally. The OS may assign a PID of 1
to any new application which comes up.


Please help.

TIA
Praveen

On Tue, Feb 9, 2010 at 5:21 PM, Paul Herring <[email protected]> wrote:

>
>
> On Tue, Feb 9, 2010 at 11:42 AM, Praveen S 
> <[email protected]<mailpraveens%40gmail.com>>
> wrote:
> > Hi,
> >
> > Lets assume the database is nothing but a file where i write if some
> > application can got access to it or not. Say i write a True value when it
> > gains access and on exit i make it false. But suppose the application
> gains
> > access to the file and writes a true value but it exits abnormally then
> > other applications which also use the same shared object library will
> check
> > the value in that file. They wil find it true.
>
> Then, if you're reinventing wheels, you need a method whereby you can
> reset that value to false externally. Or have your library time out an
> application with a lock such that if the application does time out, it
> no longer has access unless it reacquires the lock.
>
>
> > And yes the value is changed to false after every reboot because we know
> no
> > application will be running on reboot which uses that library. All are
> > executed only after bootup of device.
> >
> > So i want to get a design where
> > 1) We can handle abnormal termination scenario
> > 2) We can unlock based on abnormal termination.
> >
> >
> > TIA
> > Praveen
> >
> > On Tue, Feb 9, 2010 at 4:42 PM, shantibhushan sale <
> > [email protected] <shantibhushan.sale%40gmail.com>> wrote:
> >
> >>
> >>
> >> Hey,
> >> You can write a log file which maintains state of your
> >> synchronization's variables/data.Whenever you restart application,check
> >> with
> >> log file.
> >>
> >> ACID properties of database can be taken care if you are following
> standard
> >> database system.
> >>
> >>
> >> On Tue, Feb 9, 2010 at 1:57 PM, Praveen S 
> >> <[email protected]<mailpraveens%40gmail.com>
> <mailpraveens%40gmail.com>>
>
> >> wrote:
> >>
> >> >
> >> >
> >> > Hi,
> >> >
> >> > I am writing a mobile application library which uses a database. The
> >> > database is locked by applications using the library. On exit the
> >> > applications will unlock the database.
> >> >
> >> > However if the application terminates abnormally then the database is
> in
> >> > locked state only. Can you tell me some solution through which if a
> >> > application exits abnormally the database can be unlocked without
> having
> >> to
> >> > restart the device. On restart the database is always set to unlock
> mode.
> >> >
> >> > Thanks in advance,
> >> > Praveen
> >> >
> >> > [Non-text portions of this message have been removed]
> >> >
> >> >
> >> >
> >>
> >> --
> >> ----------------------------
> >> Regards
> >> Shantibhushan Sale
> >> Mumbai
> >> +91 9769396331
> >>
> >> [Non-text portions of this message have been removed]
> >>
> >>
> >>
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > To unsubscribe, send a blank message to <mailto:
> [email protected] 
> <c-prog-unsubscribe%40yahoogroups.com>>.Yahoo!
> Groups Links
>
> >
> >
> >
> >
>
> --
> PJH
>
> http://shabbleland.myminicity.com/env
> http://www.chavgangs.com/register.php?referer=9375
>  
>


[Non-text portions of this message have been removed]

Reply via email to