Skip to content

Commit 7287712

Browse files
authored
Merge pull request #6583 from tautschnig/bugfixes/pthread-create
C library: define exactly one function per comment block
2 parents b84474b + 41c96f5 commit 7287712

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/ansi-c/library/pthread_lib.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,16 +531,10 @@ inline int pthread_rwlock_wrlock(pthread_rwlock_t *lock)
531531
return 0; // we never fail
532532
}
533533

534-
/* FUNCTION: pthread_create */
535-
536-
#ifndef __CPROVER_PTHREAD_H_INCLUDED
537-
#include <pthread.h>
538-
#define __CPROVER_PTHREAD_H_INCLUDED
539-
#endif
534+
/* FUNCTION: __spawned_thread */
540535

541536
extern __CPROVER_bool __CPROVER_threads_exited[];
542537
extern __CPROVER_thread_local unsigned long __CPROVER_thread_id;
543-
extern unsigned long __CPROVER_next_thread_id;
544538

545539
extern __CPROVER_thread_local const void *__CPROVER_thread_keys[];
546540
extern __CPROVER_thread_local void (*__CPROVER_thread_key_dtors[])(void *);
@@ -595,6 +589,26 @@ __CPROVER_HIDE:;
595589
__CPROVER_threads_exited[this_thread_id] = 1;
596590
}
597591

592+
/* FUNCTION: pthread_create */
593+
594+
#ifndef __CPROVER_PTHREAD_H_INCLUDED
595+
# include <pthread.h>
596+
# define __CPROVER_PTHREAD_H_INCLUDED
597+
#endif
598+
599+
extern unsigned long __CPROVER_next_thread_id;
600+
601+
void __spawned_thread(
602+
unsigned long this_thread_id,
603+
#if 0
604+
// Destructor support is disabled as it is too expensive due to its extensive
605+
// use of shared variables.
606+
void (**thread_key_dtors)(void *),
607+
#endif
608+
unsigned long next_thread_key,
609+
void *(*start_routine)(void *),
610+
void *arg);
611+
598612
inline int pthread_create(
599613
pthread_t *thread, // must not be null
600614
const pthread_attr_t *attr, // may be null

0 commit comments

Comments
 (0)