#include "token.h"
#include "parser.h"
+PHP_MINIT_FUNCTION(psi_context);
PHP_MINIT_FUNCTION(psi_context)
{
unsigned flags = 0;
return SUCCESS;
}
+PHP_MSHUTDOWN_FUNCTION(psi_context);
PHP_MSHUTDOWN_FUNCTION(psi_context)
{
if (psi_check_env("PSI_DUMP")) {
n = php_scandir(ptr, &entries, psi_select_dirent, alphasort);
if (n < 0) {
+ char cwd[PATH_MAX];
C->error(PSI_DATA(C), NULL, PSI_WARNING,
- "Failed to scan PSI directory '%s':%s", strerror(errno));
+ "Failed to scan PSI directory '%s%s%s': %s",
+ *ptr == '/' ? "" : getcwd(cwd, PATH_MAX),
+ *ptr != '/' && *ptr != '.' ? "/" : "",
+ ptr, strerror(errno));
} else {
for (i = 0; i < n; ++i) {
worker = psi_context_build_worker_init(C, ptr, entries[i]->d_name);
+ PSI_DEBUG_PRINT(C, "PSI: init worker(%p) for %s/%s\n",
+ worker, ptr, entries[i]->d_name);
if (worker) {
workers = psi_plist_add(workers, &worker);
}
while (psi_plist_count(workers) && active < pool) {
if (psi_plist_pop(workers, &worker)) {
+ PSI_DEBUG_PRINT(C, "PSI: starting worker %p\n", worker);
if (psi_context_build_worker_exec(worker)) {
running = psi_plist_add(running, &worker);
++active;
while (psi_plist_get(running, i++, &worker)) {
if (psi_context_build_worker_done(worker)) {
+ PSI_DEBUG_PRINT(C, "PSI: collecting worker %p\n", worker);
psi_context_add(C, &worker->parser);
psi_plist_del(running, --i, NULL);
psi_context_build_worker_free(&worker);
if (psi_plist_pop(workers, &worker)) {
- psi_plist_add(running, &worker);
+ PSI_DEBUG_PRINT(C, "PSI: starting worker %p\n", worker);
+ if (psi_context_build_worker_exec(worker)) {
+ running = psi_plist_add(running, &worker);
+ }
} else {
--active;
}