diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-08-11 17:30:39 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-08-13 11:28:08 +0200 |
commit | efbb5e8c57330ec730825aa31ac5153f1d1c5913 (patch) | |
tree | 3357b386711f8bff93fc1db7f4c084576ee3ccf8 /src | |
parent | 1fcaa71291e896a653826fefd8e0d73a9d4ed41d (diff) | |
download | strongswan-efbb5e8c57330ec730825aa31ac5153f1d1c5913.tar.bz2 strongswan-efbb5e8c57330ec730825aa31ac5153f1d1c5913.tar.xz |
Ensure thread IDs always start with 1 even if the library is reused
Within the Android App the library stays loaded in memory and is just
initialized/deinitialized with each connection, the static thread
counter would continuously increase without this patch.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/threading/thread.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstrongswan/threading/thread.c b/src/libstrongswan/threading/thread.c index 49a1b8430..9ef514ebc 100644 --- a/src/libstrongswan/threading/thread.c +++ b/src/libstrongswan/threading/thread.c @@ -114,7 +114,7 @@ typedef struct { /** * Next thread ID. */ -static u_int next_id = 1; +static u_int next_id; /** * Mutex to safely access the next thread ID. @@ -452,6 +452,7 @@ void threads_init() dummy1 = thread_value_create(NULL); + next_id = 1; main_thread->id = 0; main_thread->thread_id = pthread_self(); current_thread = thread_value_create(NULL); @@ -482,4 +483,3 @@ void threads_deinit() current_thread->destroy(current_thread); id_mutex->destroy(id_mutex); } - |