diff options
| -rw-r--r-- | surf-webext-dom.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/surf-webext-dom.c b/surf-webext-dom.c index 31e1308..2f18806 100644 --- a/surf-webext-dom.c +++ b/surf-webext-dom.c @@ -31,15 +31,35 @@ #include <sys/shm.h> #include <errno.h> #include <string.h> +#include <pthread.h> + bool str_prefix(const char *str, const char *pre); +static int call=0; + +void* perform_work(void* argument) { + int passed_in_value; + + passed_in_value = *((int*) argument); + for(int i=0;i<10;i++) + { + printf("Hello World! It's me, thread with argument %d!\n", passed_in_value); + sleep(1); + } + return NULL; +} + void document_loaded_callback (WebKitWebPage *web_page, GPtrArray *elements, GVariant *user_data) { + pthread_t thread; + g_print("called counter: %i\n",call++); + pthread_create(&thread, NULL, perform_work, &call); + // TODO: g_free where appropriate !! // TODO: allow focus on input boxes/forms // TODO: Put this somehwere else? (but I dislike #defines) @@ -51,6 +71,7 @@ document_loaded_callback (WebKitWebPage *web_page, // get html doc WebKitDOMHTMLDocument *doc = webkit_web_page_get_dom_document(web_page); + if(!WEBKIT_DOM_IS_HTML_DOCUMENT(doc))return; // get url |
