PHP flock?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dusen
    Confirmed User
    • Aug 2002
    • 2251

    #1

    PHP flock?

    Based on another thread I thought I'd ask this in a new one.

    Is there any way using flock to 'queue' the file writes in php? All I see is examples how to say "can't get lock" and then die.
    Penis Pill Sponsor List and Reviews:
    http://www.pillsponsors.com
  • psili
    Confirmed User
    • Apr 2003
    • 5526

    #2
    I tried a quick google on it and didn't find anything. I suspect PHP would need to have a "threaded" process, where individual threads had a "wait until ready" state on the file lock, which I don't think PHP has. If it's doable though, I'd definitively like to know.
    Your post count means nothing.

    Comment

    • Dusen
      Confirmed User
      • Aug 2002
      • 2251

      #3
      Bump this thread
      Penis Pill Sponsor List and Reviews:
      http://www.pillsponsors.com

      Comment

      • MickeyG
        Confirmed User
        • May 2004
        • 4134

        #4
        I dont know but you could try adding a sleep(1) then loop and try again

        Comment

        • swedguy
          Confirmed User
          • Jan 2002
          • 7981

          #5
          Yeah put the lock in a while loop

          Comment

          • swedguy
            Confirmed User
            • Jan 2002
            • 7981

            #6
            http://www.google.se/search?sourceid...hile+flock+php

            examples

            Comment

            • Dusen
              Confirmed User
              • Aug 2002
              • 2251

              #7
              Wicked guys, thanks.

              According to this:

              http://www.hudzilla.org/php/8_11_0.php

              You don't even need to use a while loop?

              The file locking mechanism in PHP automatically makes processes queue up for their locks by default. For example, save this next script as flock.php:
              I'll test it now.
              Penis Pill Sponsor List and Reviews:
              http://www.pillsponsors.com

              Comment

              • psili
                Confirmed User
                • Apr 2003
                • 5526

                #8
                See. Sometimes this place does teach a person something.
                Your post count means nothing.

                Comment

                Working...