| 737 | */ |
| 738 | |
| 739 | TDC_element *tdc_lock_share(THD *thd, const char *db, const char *table_name) |
| 740 | { |
| 741 | TDC_element *element; |
| 742 | char key[MAX_DBKEY_LENGTH]; |
| 743 | |
| 744 | DBUG_ENTER("tdc_lock_share"); |
| 745 | if (unlikely(fix_thd_pins(thd))) |
| 746 | DBUG_RETURN((TDC_element*) MY_ERRPTR); |
| 747 | |
| 748 | element= (TDC_element *) lf_hash_search(&tdc_hash, thd->tdc_hash_pins, |
| 749 | (uchar*) key, |
| 750 | tdc_create_key(key, db, table_name)); |
| 751 | if (element) |
| 752 | { |
| 753 | mysql_mutex_lock(&element->LOCK_table_share); |
| 754 | if (unlikely(!element->share || element->share->error)) |
| 755 | { |
| 756 | mysql_mutex_unlock(&element->LOCK_table_share); |
| 757 | element= 0; |
| 758 | } |
| 759 | lf_hash_search_unpin(thd->tdc_hash_pins); |
| 760 | } |
| 761 | |
| 762 | DBUG_RETURN(element); |
| 763 | } |
| 764 | |
| 765 | |
| 766 | /** |
no test coverage detected