mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 09:02:11 +01:00
* Handles associated events. * triggers pipeline * Adjusts comment. * Uses fixed version. * Update watch_pattern_test.go --------- Co-authored-by: Alliballibaba <alliballibaba@gmail.com> Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
27 lines
670 B
C
27 lines
670 B
C
// clang-format off
|
|
//go:build !nowatcher
|
|
// clang-format on
|
|
#include "_cgo_export.h"
|
|
#include "wtr/watcher-c.h"
|
|
|
|
void handle_event(struct wtr_watcher_event event, void *data) {
|
|
go_handle_file_watcher_event(
|
|
(char *)event.path_name, (char *)event.associated_path_name,
|
|
event.effect_type, event.path_type, (uintptr_t)data);
|
|
}
|
|
|
|
uintptr_t start_new_watcher(char const *const path, uintptr_t data) {
|
|
void *watcher = wtr_watcher_open(path, handle_event, (void *)data);
|
|
if (watcher == NULL) {
|
|
return 0;
|
|
}
|
|
return (uintptr_t)watcher;
|
|
}
|
|
|
|
int stop_watcher(uintptr_t watcher) {
|
|
if (!wtr_watcher_close((void *)watcher)) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|