MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / main

Function main

mysys/thr_lock.c:1602–1701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1600
1601
1602int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
1603{
1604 pthread_t tid;
1605 pthread_attr_t thr_attr;
1606 int i,*param,error;
1607 MY_INIT(argv[0]);
1608 if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
1609 DBUG_PUSH(argv[1]+2);
1610
1611 printf("Main thread: %s\n",my_thread_name());
1612
1613 if ((error= mysql_cond_init(0, &COND_thread_count, NULL)))
1614 {
1615 fprintf(stderr, "Got error: %d from mysql_cond_init (errno: %d)",
1616 error,errno);
1617 exit(1);
1618 }
1619 if ((error= mysql_mutex_init(0, &LOCK_thread_count, MY_MUTEX_INIT_FAST)))
1620 {
1621 fprintf(stderr, "Got error: %d from mysql_cond_init (errno: %d)",
1622 error,errno);
1623 exit(1);
1624 }
1625
1626 for (i=0 ; i < (int) array_elements(locks) ; i++)
1627 {
1628 thr_lock_init(locks+i);
1629 locks[i].check_status= test_check_status;
1630 locks[i].update_status=test_update_status;
1631 locks[i].copy_status= test_copy_status;
1632 locks[i].get_status= test_get_status;
1633 }
1634 if ((error=pthread_attr_init(&thr_attr)))
1635 {
1636 fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)",
1637 error,errno);
1638 exit(1);
1639 }
1640 if ((error=pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED)))
1641 {
1642 fprintf(stderr,
1643 "Got error: %d from pthread_attr_setdetachstate (errno: %d)",
1644 error,errno);
1645 exit(1);
1646 }
1647#ifndef pthread_attr_setstacksize /* void return value */
1648 if ((error=pthread_attr_setstacksize(&thr_attr,65536L)))
1649 {
1650 fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)",
1651 error,errno);
1652 exit(1);
1653 }
1654#endif
1655#ifdef HAVE_THR_SETCONCURRENCY
1656 (void) thr_setconcurrency(2);
1657#endif
1658 for (i=0 ; i < (int) array_elements(lock_counts) ; i++)
1659 {

Callers

nothing calls this directly

Calls 6

my_thread_nameFunction · 0.85
thr_lock_initFunction · 0.85
pthread_attr_initFunction · 0.85
pthread_attr_destroyFunction · 0.85
thr_lock_deleteFunction · 0.85

Tested by

no test coverage detected