> > + flock(filep_pidfile, LOCK_EX);
> >
> Won't the above call block indefinitely if the lock has already been taken by
> someone else? We don't want the behavior when someone starts a daemon
> and it simply hang there.
[Alin Gabriel Serdean: ] Hard to say from the MSDN documentation we could add
"| LOCKFILE_FAIL_IMMEDIATELY" when calling it just to be sure.
>
>
>
> > +
> > fatal_signal_add_hook(unlink_pidfile, NULL, NULL, true);
> >
> > fprintf(filep_pidfile, "%d\n", _getpid()); @@ -444,6 +481,10 @@
> > make_pidfile(void)
> > VLOG_FATAL("Failed to write into the pidfile %s", pidfile);
> > }
> >
> > + flock(filep_pidfile, LOCK_SH);
> > + /* This will remove the exclusive lock. The shared lock will remain */
> > + flock(filep_pidfile, LOCK_UN);
> >
> I unsuccessfully tried to read MSDN documentation for the above behavior.
> Can you please point me to the documentation which states that unlocking
> once will move the lock from exclusive to shared?
[Alin Gabriel Serdean: ]
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365203(v=vs.85).aspx
The part:
"If the same range is locked with an exclusive and a shared lock, two unlock
operations are necessary to unlock the region; the first unlock operation
unlocks the exclusive lock, the second unlock operation unlocks the shared
lock."
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev