summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <hf@genie.(none)>2003-03-21 11:06:15 +0400
committerunknown <hf@genie.(none)>2003-03-21 11:06:15 +0400
commit4809dc7419bbaa03658b3340e61b3f15eeec4d10 (patch)
tree6735f25527fa9c459972db22fa6488ea01be348a /sql/item_func.cc
parentd7bccdbe817be53d38cba08648998ad24626aa9b (diff)
parent1639db0883db893745746418c001a834223966e4 (diff)
downloadmariadb-git-4809dc7419bbaa03658b3340e61b3f15eeec4d10.tar.gz
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into genie.(none):/home/hf/work/mysql-4.1.lck sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/lex.h: Auto merged
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 8cb63182705..72db23d1953 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1610,8 +1610,10 @@ public:
bool locked;
pthread_cond_t cond;
pthread_t thread;
+ ulong thread_id;
- ULL(const char *key_arg,uint length) :key_length(length),count(1),locked(1)
+ ULL(const char *key_arg,uint length, ulong id)
+ :key_length(length),count(1),locked(1), thread_id(id)
{
key=(char*) my_memdup((byte*) key_arg,length,MYF(0));
pthread_cond_init(&cond,NULL);
@@ -1815,7 +1817,7 @@ longlong Item_func_get_lock::val_int()
if (!(ull= ((ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(),
res->length()))))
{
- ull=new ULL(res->ptr(),res->length());
+ ull=new ULL(res->ptr(),res->length(), thd->thread_id);
if (!ull || !ull->initialized())
{
delete ull;
@@ -2676,6 +2678,28 @@ longlong Item_func_is_free_lock::val_int()
return 0;
}
+longlong Item_func_is_used_lock::val_int()
+{
+ String *res=args[0]->val_str(&value);
+ THD *thd=current_thd;
+ ULL *ull;
+
+ null_value=1;
+ if (!res || !res->length())
+ return 0;
+
+ pthread_mutex_lock(&LOCK_user_locks);
+ ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(),
+ res->length());
+ pthread_mutex_unlock(&LOCK_user_locks);
+ if (!ull || !ull->locked)
+ return 0;
+
+ null_value=0;
+ return ull->thread_id;
+}
+
+
/**************************************************************************
Spatial functions