138494Sobrien/* This testcase is part of GDB, the GNU debugger.
282794Sobrien
338494Sobrien   Copyright 2011-2020 Free Software Foundation, Inc.
438494Sobrien
538494Sobrien   This program is free software; you can redistribute it and/or modify
638494Sobrien   it under the terms of the GNU General Public License as published by
738494Sobrien   the Free Software Foundation; either version 3 of the License, or
838494Sobrien   (at your option) any later version.
938494Sobrien
1038494Sobrien   This program is distributed in the hope that it will be useful,
1138494Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1238494Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1338494Sobrien   GNU General Public License for more details.
1438494Sobrien
1538494Sobrien   You should have received a copy of the GNU General Public License
1638494Sobrien   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1738494Sobrien
1838494Sobrien#include <pthread.h>
1938494Sobrien#include <assert.h>
2042629Sobrien
2138494Sobrienstatic void *
2238494Sobrientfunc (void *arg)
2338494Sobrien{
2438494Sobrien  void (*notifyp) (void) = arg;
2538494Sobrien
2638494Sobrien  notifyp ();
2738494Sobrien}
2838494Sobrien
2938494Sobrienvoid
3038494Sobrienf (void (*notifyp) (void))
3138494Sobrien{
3238494Sobrien  pthread_t t;
3338494Sobrien  int i;
3438494Sobrien
3538494Sobrien  i = pthread_create (&t, NULL, tfunc, notifyp);
3638494Sobrien  assert (i == 0);
3738494Sobrien
3838494Sobrien  i = pthread_join (t, NULL);
3938494Sobrien  assert (i == 0);
4038494Sobrien}
4182794Sobrien