Arquivos
hhvm/hphp/runtime/ext/ext_thread.cpp
T
aalexandre 26178124a4 Eliminate int32, uint32, int16, uint16, int8, uint8.
This concludes the inttypes replacement.
These replacement have been mostly mechanical
with the use of cxx_replace.
2013-03-09 10:25:16 -08:00

69 linhas
2.6 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include <runtime/ext/ext_thread.h>
#include <runtime/base/server/service_thread.h>
#include <runtime/base/server/http_server.h>
#include <runtime/base/program_functions.h>
#include <util/process.h>
namespace HPHP {
IMPLEMENT_DEFAULT_EXTENSION(thread);
///////////////////////////////////////////////////////////////////////////////
bool f_hphp_is_service_thread() {
return ServiceThread::IsServiceThread();
}
void f_hphp_service_thread_started() {
if (!ServiceThread::IsServiceThread()) {
raise_error("hphp_service_thread_started called "
"from outside a service thread");
}
ServiceThread::GetThisThread()->notifyStarted();
}
bool f_hphp_service_thread_stopped(int timeout) {
if (!ServiceThread::IsServiceThread()) {
raise_error("hphp_service_thread_stopped called "
"from outside a service thread");
}
return ServiceThread::GetThisThread()->waitForStopped(timeout);
}
bool f_hphp_thread_is_warmup_enabled() {
return hphp_is_warmup_enabled();
}
void f_hphp_thread_set_warmup_enabled() {
raise_warning("hphp_thread_set_warmup_enabled is deprecated, to enable "
"the RequestInitFunction and RequestInitDocument features "
"please set Server.EnableMemoryManager=true in your HipHop "
"config");
}
int64_t f_hphp_get_thread_id() {
return (unsigned long)Process::GetThreadId();
}
int32_t f_hphp_gettid() {
return (unsigned int)Process::GetThreadPid();
}
///////////////////////////////////////////////////////////////////////////////
}