github.com/freddyisaac/sicortex-golang@v0.0.0-20231019035217-e03519e66f60/src/runtime/cgo/gcc_util.c (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  #include "libcgo.h"
     6  
     7  /* Stub for creating a new thread */
     8  void
     9  x_cgo_thread_start(ThreadStart *arg)
    10  {
    11  	ThreadStart *ts;
    12  
    13  	/* Make our own copy that can persist after we return. */
    14  	_cgo_tsan_acquire();
    15  	ts = malloc(sizeof *ts);
    16  	_cgo_tsan_release();
    17  	if(ts == nil) {
    18  		fprintf(stderr, "runtime/cgo: out of memory in thread_start\n");
    19  		abort();
    20  	}
    21  	*ts = *arg;
    22  
    23  	_cgo_sys_thread_start(ts);	/* OS-dependent half */
    24  }