mirror of
https://github.com/php/php-src.git
synced 2024-12-17 05:50:14 +08:00
06332e6706
The particular need on this is because of the current situation with determining the background functionality for the gettimeofday. DllMain allows to initialize stuff before the DLL can be actually used. Thus, we use different time API on win7 and win8 and later, so the function pointer needs to be initialized before anything in the DLL could even demand it. The change also opens the door for the further optimizations, as now we're able to do the very basic initializations for the whole DLL before it could ever start to live. Fe on this way the TLS initialization could be done, when utilizing the DLL_THREAD_ATTACH/DETACH case. Whether it's really usable in portable way should be synced with other platforms. Be aware that it's dangerous as it possibly causes dead locks. So to use with care. One willing to add items to DllMain should better read the documentation twice and even then try to defer the necessary action.
62 lines
2.0 KiB
C
62 lines
2.0 KiB
C
/*****************************************************************************
|
|
* *
|
|
* sys/time.h *
|
|
* *
|
|
* Freely redistributable and modifiable. Use at your own risk. *
|
|
* *
|
|
* Copyright 1994 The Downhill Project *
|
|
*
|
|
* Modified by Shane Caraveo for PHP
|
|
*
|
|
*****************************************************************************/
|
|
#ifndef TIME_H
|
|
#define TIME_H
|
|
|
|
/* Include stuff ************************************************************ */
|
|
#include <time.h>
|
|
#include "php.h"
|
|
|
|
/* Struct stuff ************************************************************* */
|
|
struct timezone {
|
|
int tz_minuteswest;
|
|
int tz_dsttime;
|
|
};
|
|
|
|
|
|
struct itimerval {
|
|
struct timeval it_interval; /* next value */
|
|
struct timeval it_value; /* current value */
|
|
};
|
|
|
|
#if !defined(timespec) && _MSC_VER < 1900
|
|
struct timespec
|
|
{
|
|
time_t tv_sec; /* seconds */
|
|
long tv_nsec; /* nanoseconds */
|
|
};
|
|
#endif
|
|
|
|
#define ITIMER_REAL 0 /*generates sigalrm */
|
|
#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
|
|
#define ITIMER_VIRT 1 /*generates sigvtalrm */
|
|
#define ITIMER_PROF 2 /*generates sigprof */
|
|
|
|
/* Prototype stuff ********************************************************** */
|
|
PHPAPI extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
|
|
|
|
/* setitimer operates at 100 millisecond resolution */
|
|
PHPAPI extern int setitimer(int which, const struct itimerval *value,
|
|
struct itimerval *ovalue);
|
|
|
|
PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp );
|
|
|
|
PHPAPI int usleep(unsigned int useconds);
|
|
|
|
#ifdef PHP_EXPORTS
|
|
/* This symbols are needed only for the DllMain, but should not be exported
|
|
or be available when used with PHP binaries. */
|
|
BOOL php_win32_init_gettimeofday(void);
|
|
#endif
|
|
|
|
#endif
|