diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-06-05 00:15:14 -0400 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:15 +0200 |
commit | 08275ebda825e8f6f03e3329793b72e34affad2f (patch) | |
tree | b4de8d87b74024df04a33d4cac29f8f92aa54a0b /nexgb/xgb.go | |
parent | a9eae45cb3977bce5983e817d00d4584d176b044 (diff) | |
download | haven-08275ebda825e8f6f03e3329793b72e34affad2f.tar.gz haven-08275ebda825e8f6f03e3329793b72e34affad2f.tar.xz haven-08275ebda825e8f6f03e3329793b72e34affad2f.zip |
Doc fixes and stop exporting ReplyChecked and ReplyUnchecked
Diffstat (limited to 'nexgb/xgb.go')
-rw-r--r-- | nexgb/xgb.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/nexgb/xgb.go b/nexgb/xgb.go index 7df0fac..c62cc85 100644 --- a/nexgb/xgb.go +++ b/nexgb/xgb.go @@ -162,7 +162,7 @@ var NewExtErrorFuncs = make(map[string]map[int]NewErrorFun) // error. type eventOrError interface{} -// NewID generates a new unused ID for use with requests like CreateWindow. +// NewId generates a new unused ID for use with requests like CreateWindow. // If no new ids can be generated, the id returned is 0 and error is non-nil. // This shouldn't be used directly, and is exported for use in the extension // sub-packages. @@ -269,6 +269,20 @@ type request struct { // a request type, and sends it over the Conn.reqChan channel. // Note that the sequence number is added to the cookie after it is sent // over the request channel, but before it is sent to X. +// +// Note that you may safely use NewRequest to send arbitrary byte requests +// to X. The resulting cookie can be used just like any normal cookie and +// abides by the same rules, except that for replies, you'll get back the +// raw byte data. This may be useful for performance critical sections where +// every allocation counts, since all X requests in XGB allocate a new byte +// slice. In contrast, NewRequest allocates one small request struct and +// nothing else. (Except when the cookie buffer is full and has to be flushed.) +// +// If you're using NewRequest manually, you'll need to use NewCookie to create +// a new cookie. +// +// In all likelihood, you should be able to copy and paste with some minor +// edits the generated code for the request you want to issue. func (c *Conn) NewRequest(buf []byte, cookie *Cookie) { c.reqChan <- &request{buf: buf, cookie: cookie} } |