MCPcopy Create free account
hub / github.com/apache/cloudberry / func_call_2

Function func_call_2

src/test/thread/thread_test.c:380–457  ·  view source on GitHub ↗

* func_call_2 */

Source from the content-addressed store, hash-verified

378 * func_call_2
379 */
380static void
381func_call_2(void)
382{
383#if !defined(HAVE_GETPWUID_R) || \
384 (!defined(HAVE_GETADDRINFO) && \
385 !defined(HAVE_GETHOSTBYNAME_R))
386 void *p;
387#endif
388
389 unlink(TEMP_FILENAME_2);
390
391 /* Set errno = ENOENT */
392
393 /* This will fail, but we can't check errno yet */
394 if (unlink(TEMP_FILENAME_2) != -1)
395 {
396 fprintf(stderr,
397 "Could not generate failure for unlink of %s in current directory **\nexiting\n",
398 TEMP_FILENAME_2);
399 exit(1);
400 }
401
402 /*
403 * Wait for other thread to set errno. We can't use thread-specific
404 * locking here because it might affect errno.
405 */
406 errno2_set = 1;
407 while (errno1_set == 0)
408 sched_yield();
409
410#ifdef WIN32
411 if (GetLastError() != ENOENT)
412#else
413 if (errno != ENOENT)
414#endif
415 {
416#ifdef WIN32
417 fprintf(stderr, "GetLastError() not thread-safe **\nexiting\n");
418#else
419 fprintf(stderr, "errno not thread-safe **\nexiting\n");
420#endif
421 exit(1);
422 }
423
424#ifndef HAVE_STRERROR_R
425
426 /*
427 * If strerror() uses sys_errlist, the pointer might change for different
428 * errno values, so we don't check to see if it varies within the thread.
429 */
430 strerror_p2 = strerror(EINVAL);
431#endif
432
433#if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
434 passwd_p2 = getpwuid(2);
435 p = getpwuid(3);
436 if (passwd_p2 != p)
437 {

Callers

nothing calls this directly

Calls 3

GetLastErrorFunction · 0.85
pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected