summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/chan.c
AgeCommit message (Collapse)AuthorFilesLines
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý1-137/+157
2010-05-01gc: be pickier about slice, chan, array, and map sizesRuss Cox1-3/+6
Fixes issue 589. R=ken2 CC=golang-dev http://codereview.appspot.com/1032044
2010-04-06another try at clearingKen Thompson1-9/+6
channel recv data. R=rsc CC=golang-dev http://codereview.appspot.com/896041
2010-04-06change channel read to clearKen Thompson1-3/+12
data just read from the channel. this will make it easier to recognize when to garbage collect and finalize. R=rsc CC=golang-dev http://codereview.appspot.com/882043
2010-04-01runtime: correct memory leak in selectRuss Cox1-179/+125
* adds pass 3 to dequeue from channels eagerly various other cleanup/churn: * use switch on cas->send in each pass to factor out common code. * longer goto labels, commented at target * be more agressive about can't happen: throw instead of print + cope. * use "select" instead of "selectgo" in errors * use printf for debug prints when possible R=ken2, ken3 CC=golang-dev, r http://codereview.appspot.com/875041
2010-03-04cc: disallow ... argument unless NOSPLIT is set.Russ Cox1-0/+8
check that NOSPLIT functions don't use too much stack. correct some missing NOSPLITs in the runtime library. Fixes bug reported in https://groups.google.com/group/golang-nuts/t/efff68b73941eccf R=ken2 CC=golang-dev http://codereview.appspot.com/236041
2010-02-08runtime: allow arbitrary return type in SetFinalizer.Russ Cox1-0/+9
finalize chan, to free OS X semaphore inside Lock. os: finalize File, to close fd. Fixes issue 503. R=ken2 CC=golang-dev http://codereview.appspot.com/204065
2010-01-25in C and asm, replace pkg·name with ·nameRuss Cox1-53/+53
(eliminate assumption of package global name space, make code easier to move between packages). R=r CC=golang-dev http://codereview.appspot.com/194072
2010-01-09runtime: check for preemption due to garbage collectionRuss Cox1-0/+12
in various already expensive routines. helps keep cpu utilization up when GOMAXPROCS > 1, but not a full solution. http://groups.google.com/group/golang-nuts/t/7a9535c4136d3e2 R=r CC=golang-dev http://codereview.appspot.com/184043
2009-12-18runtime: fix race conditionAdam Langley1-4/+2
(Thanks to ken and rsc for pointing this out) rsc: ken pointed out that there's a race in the new one-lock-per-channel code. the issue is that if one goroutine has gone to sleep doing select { case <-c1: case <-c2: } and then two more goroutines try to send on c1 and c2 simultaneously, the way that the code makes sure only one wins is the selgen field manipulation in dequeue: // if sgp is stale, ignore it if(sgp->selgen != sgp->g->selgen) { //prints("INVALID PSEUDOG POINTER\n"); freesg(c, sgp); goto loop; } // invalidate any others sgp->g->selgen++; but because the global lock is gone both goroutines will be fiddling with sgp->g->selgen at the same time. This results in a 7% slowdown in the single threaded case for a ping-pong microbenchmark. Since the cas predominantly succeeds, adding a simple check first didn't make any difference. R=rsc CC=golang-dev http://codereview.appspot.com/180068
2009-12-15runtime: return zero value in x, ok = <-c when ok == falseRuss Cox1-0/+2
Fixes issue 401. R=ken2 http://codereview.appspot.com/180053
2009-12-04runtime: shift the index for the sort by one.Adam Langley1-6/+2
Makes the code look cleaner, even if it's a little harder to figure out from the sort invariants. R=rsc CC=golang-dev http://codereview.appspot.com/165061
2009-12-04Remove global chanlock.Adam Langley1-33/+75
On a microbenchmark that ping-pongs on lots of channels, this makes the multithreaded case about 20% faster and the uniprocessor case about 1% slower. (Due to cache effects, I expect.) R=rsc, agl CC=golang-dev http://codereview.appspot.com/166043
2009-10-28Fix bug when sending via select.Adam Langley1-32/+19
selfree maintains a cache of Select structures for several sizes. In newselect, we'll use an entry from the cache if one is found. However, the Scase structures corresponding to a send may have been allocated for the wrong size. In this case we'll write off the end of the Scase into random memory and, generally, read some amount of junk in the receive. This patch fixes the issue by removing the cache, on the advice of rsc. R=rsc CC=go-dev http://go/go-review/1016002
2009-10-15rename sys functions to runtime,Russ Cox1-53/+53
because they are in package runtime. another step to enforcing package boundaries. R=r DELTA=732 (114 added, 93 deleted, 525 changed) OCL=35811 CL=35824
2009-09-08pass Type* to makechan and makemap so thatRuss Cox1-11/+16
they can get the official alignment out of there instead of guessing. R=ken OCL=34450 CL=34450
2009-08-26finish ChanValue: Len and Cap.Russ Cox1-0/+12
R=r DELTA=45 (45 added, 0 deleted, 0 changed) OCL=33873 CL=33881
2009-08-26add Close() and Closed() to ChanValueRuss Cox1-4/+14
R=r DELTA=60 (56 added, 3 deleted, 1 changed) OCL=33868 CL=33872
2009-08-25rename runtime internals to have modern names (array->slice etc)Rob Pike1-4/+4
R=rsc DELTA=444 (179 added, 177 deleted, 88 changed) OCL=33847 CL=33849
2009-08-20len and cap on chansRuss Cox1-2/+2
R=ken OCL=33599 CL=33599
2009-08-17Removing dead tests from chan.cBill Neubauer1-4/+0
Since pres != nil was already checked and the routine sets *pres to false and returns, the subsequent tests are unneeded. R=rsc APPROVED=rsc DELTA=4 (0 added, 4 deleted, 0 changed) OCL=33439 CL=33441
2009-07-17another step toward eliminating forward declarations.Russ Cox1-7/+0
introduce NodeList* type in compiler to replace OLIST. this clarifies where lists can and cannot occur. list append and concatenation are now cheap. the _r rules are gone from yacc. rev and unrev are gone. no more lists of lists. the representation of assignments is a bit clunkier. split into OAS (1=1) and OAS2 (2 or more on one side). delete dead chanrecv3 code. delay construction of func types. R=ken OCL=31745 CL=31762
2009-07-08reflection for channelsRuss Cox1-12/+16
R=r DELTA=188 (171 added, 6 deleted, 11 changed) OCL=31352 CL=31361
2009-07-02move Structrnd to runtime.hRuss Cox1-4/+0
R=ken OCL=31125 CL=31125
2009-06-30change alignment rules: roll receiver intoRuss Cox1-9/+17
input parameters, move output parameters into their own struct. R=ken OCL=30954 CL=30966
2009-06-09mv src/lib to src/pkgRob Pike1-0/+1024
tests: all.bash passes, gobuild still works, godoc still works. R=rsc OCL=30096 CL=30102