#At file:///usr/home/serg/Abk/mysql/6.0-maria/
2744 Sergei Golubchik 2008-10-21 [merge]
merged from mysql-maria
removed:
mysql-test/include/wait_condition.inc.moved
modified:
include/my_global.h
include/waiting_threads.h
mysys/my_wincond.c
mysys/thr_rwlock.c
mysys/waiting_threads.c
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2008-10-20 19:13:22 +0000
+++ b/include/my_global.h 2008-10-21 20:46:10 +0000
@@ -480,17 +480,15 @@ C_MODE_END
#include <assert.h>
/* an assert that works at compile-time. only for constant expression */
-#if (_MSC_VER >=1400)
-#define compile_time_assert(X) do { C_ASSERT(X); } while(0)
-#elif defined (___GNUC__)
+#ifdef _some_old_compiler_that_does_not_understand_the_construct_below_
+#define compile_time_assert(X) do { } while(0)
+#else
#define compile_time_assert(X) \
do \
{ \
char compile_time_assert[(X) ? 1 : -1] \
__attribute__ ((unused)); \
} while(0)
-#else
-#define compile_time_assert(X) do { } while(0)
#endif
/* Go around some bugs in different OS and compilers */
=== modified file 'include/waiting_threads.h'
--- a/include/waiting_threads.h 2008-09-01 19:43:11 +0000
+++ b/include/waiting_threads.h 2008-10-21 18:10:49 +0000
@@ -19,10 +19,10 @@
#include <my_global.h>
#include <my_sys.h>
-C_MODE_START
-
#include <lf.h>
+C_MODE_START
+
typedef struct st_wt_resource_id WT_RESOURCE_ID;
typedef struct st_wt_resource_type {
@@ -30,10 +30,13 @@ typedef struct st_wt_resource_type {
const void *(*make_key)(WT_RESOURCE_ID *id, uint *len);
} WT_RESOURCE_TYPE;
+/* we want to compare this struct with memcmp, make it packed */
+#pragma pack(push,1)
struct st_wt_resource_id {
- WT_RESOURCE_TYPE *type;
ulonglong value;
+ WT_RESOURCE_TYPE *type;
};
+#pragma pack(pop)
#define WT_WAIT_STATS 24
#define WT_CYCLE_STATS 32
=== removed file 'mysql-test/include/wait_condition.inc.moved'
--- a/mysql-test/include/wait_condition.inc.moved 2008-06-25 17:01:17 +0000
+++ b/mysql-test/include/wait_condition.inc.moved 1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
-# include/wait_condition.inc
-#
-# SUMMARY
-#
-# Waits until the passed statement returns true, or the operation
-# times out.
-#
-# USAGE
-#
-# let $wait_condition=
-# SELECT c = 3 FROM t;
-# --source include/wait_condition.inc
-#
-# OR
-#
-# let $wait_timeout= 60; # Override default 30 seconds with 60.
-# let $wait_condition=
-# SELECT c = 3 FROM t;
-# --source include/wait_condition.inc
-# --echo Executed the test condition $wait_condition_reps times
-#
-# EXAMPLE
-# events_bugs.test, events_time_zone.test
-#
-
---disable_query_log
-
-let $wait_counter= 300;
-if ($wait_timeout)
-{
- let $wait_counter= `SELECT $wait_timeout * 10`;
-}
-# Reset $wait_timeout so that its value won't be used on subsequent
-# calls, and default will be used instead.
-let $wait_timeout= 0;
-
-# Keep track of how many times the wait condition is tested
-# This is used by some tests (e.g., main.status)
-let $wait_condition_reps= 0;
-while ($wait_counter)
-{
- let $success= `$wait_condition`;
- inc $wait_condition_reps;
- if ($success)
- {
- let $wait_counter= 0;
- }
- if (!$success)
- {
- real_sleep 0.1;
- dec $wait_counter;
- }
-}
-if (!$success)
-{
- echo Timeout in wait_condition.inc for $wait_condition;
-}
-
---enable_query_log
=== modified file 'mysys/my_wincond.c'
--- a/mysys/my_wincond.c 2007-05-10 09:59:39 +0000
+++ b/mysys/my_wincond.c 2008-10-21 14:10:04 +0000
@@ -126,7 +126,7 @@ int pthread_cond_timedwait(pthread_cond_
EnterCriticalSection(&cond->lock_waiting);
cond->waiting--;
- if (cond->waiting == 0 && result == (WAIT_OBJECT_0+BROADCAST))
+ if (cond->waiting == 0)
{
/*
We're the last waiter to be notified or to stop waiting, so
=== modified file 'mysys/thr_rwlock.c'
--- a/mysys/thr_rwlock.c 2006-12-23 19:17:15 +0000
+++ b/mysys/thr_rwlock.c 2008-10-21 14:10:04 +0000
@@ -89,7 +89,7 @@ int my_rw_rdlock(rw_lock_t *rwp)
pthread_mutex_lock(&rwp->lock);
/* active or queued writers */
- while (( rwp->state < 0 ) || rwp->waiters)
+ while (( rwp->state < 0 ))
pthread_cond_wait( &rwp->readers, &rwp->lock);
rwp->state++;
@@ -101,7 +101,7 @@ int my_rw_tryrdlock(rw_lock_t *rwp)
{
int res;
pthread_mutex_lock(&rwp->lock);
- if ((rwp->state < 0 ) || rwp->waiters)
+ if ((rwp->state < 0 ))
res= EBUSY; /* Can't get lock */
else
{
=== modified file 'mysys/waiting_threads.c'
--- a/mysys/waiting_threads.c 2008-09-01 19:43:11 +0000
+++ b/mysys/waiting_threads.c 2008-10-21 18:10:49 +0000
@@ -347,6 +347,8 @@ void wt_thd_destroy(WT_THD *thd)
*/
int wt_resource_id_memcmp(void *a, void *b)
{
+ /* assert that the structure is not padded with random bytes */
+ compile_time_assert(sizeof(WT_RESOURCE_ID)==sizeof(ulonglong)+sizeof(void*));
return memcmp(a, b, sizeof(WT_RESOURCE_ID));
}
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (serg:2744) | Sergei Golubchik | 21 Oct |