aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--NEWS1
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc4
-rw-r--r--plugin/icedteanp/IcedTeaPluginRequestProcessor.cc35
4 files changed, 49 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 84dd6ed..a05865d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-24 Deepak Bhole <[email protected]>
+
+ Fix PR552: Support for FreeBSD's pthread implementation (patch from
+ * plugin/icedteanp/IcedTeaNPPlugin.cc
+ (NP_Shutdown): Do pthread_join after cancel to avoid destroying mutexes
+ or condition variables in use.
+ * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
+ (PluginRequestProcessor): Initialize mutexes dynamically.
+ (queue_cleanup): New method. Destroy dynamically created mytexes.
+ (queue_processor): Initialize wait_mutex and push cleanup on exit. Clean
+ up after processing stops.
+
2010-11-24 Andrew John Hughes <[email protected]>
* NEWS: Bring in changes from IcedTea6 1.10
diff --git a/NEWS b/NEWS
index 8a339cb..e4c4c1d 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ New in release 1.0 (2010-XX-XX):
- RH645843, CVE-2010-3860: IcedTea System property information leak via public static
* Plugin
- PR542: Plugin fails with NPE on http://www.openprocessing.org/visuals/iframe.php?visualID=2615
+ - PR552: Support for FreeBSD's pthread implementation
- PR554: System.err writes content two times
- PR556: Applet initialization code is prone to race conditions
- PR557: Applet opens in a separate window if tab is closed when the applet loads
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
index a680d23..a1fb809 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
@@ -2372,6 +2372,10 @@ NP_Shutdown (void)
pthread_cancel(plugin_request_processor_thread2);
pthread_cancel(plugin_request_processor_thread3);
+ pthread_join(plugin_request_processor_thread1, NULL);
+ pthread_join(plugin_request_processor_thread2, NULL);
+ pthread_join(plugin_request_processor_thread3, NULL);
+
java_to_plugin_bus->unSubscribe(plugin_req_proc);
plugin_to_java_bus->unSubscribe(java_req_proc);
//internal_bus->unSubscribe(java_req_proc);
diff --git a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
index 373be59..20fce27 100644
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
@@ -63,6 +63,12 @@ PluginRequestProcessor::PluginRequestProcessor()
this->pendingRequests = new std::map<pthread_t, uintmax_t>();
internal_req_ref_counter = 0;
+
+ pthread_mutex_init(&message_queue_mutex, NULL);
+ pthread_mutex_init(&syn_write_mutex, NULL);
+ pthread_mutex_init(&tc_mutex, NULL);
+
+ pthread_cond_init(&cond_message_available, NULL);
}
/**
@@ -77,6 +83,12 @@ PluginRequestProcessor::~PluginRequestProcessor()
if (pendingRequests)
delete pendingRequests;
+
+ pthread_mutex_destroy(&message_queue_mutex);
+ pthread_mutex_destroy(&syn_write_mutex);
+ pthread_mutex_destroy(&tc_mutex);
+
+ pthread_cond_destroy(&cond_message_available);
}
/**
@@ -701,6 +713,14 @@ PluginRequestProcessor::finalize(std::vector<std::string*>* message_parts)
plugin_to_java_bus->post(response.c_str());
}
+static void
+queue_cleanup(void* data)
+{
+
+ pthread_mutex_destroy((pthread_mutex_t*) data);
+
+ PLUGIN_DEBUG("Queue processing stopped.\n");
+}
void*
queue_processor(void* data)
@@ -709,10 +729,14 @@ queue_processor(void* data)
PluginRequestProcessor* processor = (PluginRequestProcessor*) data;
std::vector<std::string*>* message_parts = NULL;
std::string command;
- pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER; // This is needed for API compat. and is unused
+ pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
PLUGIN_DEBUG("Queue processor initialized. Queue = %p\n", message_queue);
+ pthread_mutex_init(&wait_mutex, NULL);
+
+ pthread_cleanup_push(queue_cleanup, (void*) &wait_mutex);
+
while (true)
{
pthread_mutex_lock(&message_queue_mutex);
@@ -780,14 +804,17 @@ queue_processor(void* data)
} else
{
- pthread_cond_wait(&cond_message_available, &wait_mutex);
- pthread_testcancel();
+ pthread_mutex_lock(&wait_mutex);
+ pthread_cond_wait(&cond_message_available, &wait_mutex);
+ pthread_mutex_unlock(&wait_mutex);
}
message_parts = NULL;
+
+ pthread_testcancel();
}
- PLUGIN_DEBUG("Queue processing stopped.\n");
+ pthread_cleanup_pop(1);
}
/******************************************