Show
Ignore:
Timestamp:
06/21/06 21:02:56 (3 years ago)
Author:
bart
Message:

* Branched the 0.9.4 release to fix win32
* Fixes from Simon Westwood

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/branches/0.9.4/debug.c

    r144 r215  
    7373} 
    7474 
    75 /* lock the log file, don't lock stderr */ 
    76 static void ea_debug_lock() { 
    77     int rc; 
    78     struct flock l; 
    79     if (F_fp != stderr) { 
    80         l.l_whence   = SEEK_SET; 
    81         l.l_start    = 0; 
    82         l.l_len      = 0; 
    83         l.l_pid      = 0; 
    84         l.l_type     = F_WRLCK; 
    85         do { 
    86             rc = fcntl(file_no, F_SETLKW, &l); 
    87         } while (rc < 0 && errno == EINTR); 
    88     } 
    89 } 
    90  
    91 static void ea_debug_unlock() { 
    92     int rc; 
    93     struct flock l; 
    94     if (F_fp != stderr) { 
    95         l.l_whence   = SEEK_SET; 
    96         l.l_start    = 0; 
    97         l.l_len      = 0; 
    98         l.l_pid      = 0; 
    99         l.l_type     = F_UNLCK; 
    100         do { 
    101             rc = fcntl(file_no, F_SETLKW, &l); 
    102         } while (rc < 0 && errno == EINTR); 
    103     } 
    104 } 
    105  
    10675/** 
    10776 * Print a log message that will be print when the debug level is 
     
    11988        va_end (args); 
    12089 
    121         ea_debug_lock(); 
    122 #ifdef ZEND_WIN32 
    123         OutputDebugString (output_buf); 
    124 #else 
    125         fputs (output_buf, F_fp); 
    126         fflush (F_fp); 
    127 #endif 
    128         ea_debug_unlock(); 
     90        if (F_fp != stderr) { 
     91                        EACCELERATOR_FLOCK(file_no, LOCK_EX); 
     92                } 
     93                fputs (output_buf, F_fp); 
     94                fflush (F_fp); 
     95                if (F_fp != stderr) { 
     96                        EACCELERATOR_FLOCK(file_no, LOCK_UN); 
     97                } 
     98 
    12999    } 
    130100}