freenode/#lisp - IRC Chatlog
Search
1:35:43
dxtr
So I'm trying to use READ-SEQUENCE on a usocket stream and it's blocking indefinitely - even though I'm receiving data. How come?
1:37:37
Josh_2
yeh you have to use something like this (socket-stream (socket-accept (socket-connect .. )))
4:03:10
didi`
How do I control how FORMAT's ~S and ~A will print my structure? I want ~S to print my structure as it normally does (#S(...)) but I want ~A to print the structure differently, in a more eye-candy way.
4:05:47
no-defun-allowed
"If [p-e is] true, an attempt is made to print an expression in such a way that it can be read again to produce an equal expression."
4:16:43
didi`
Hum. I wonder if there's a way to only implementing the aesthetic printing, i.e. I don't want to re-inplement the default printing because o it.
4:46:11
ggole
(defmethod print-object :around ((f foo) stream) (if (and (null *print-readably*) (null *print-escape*)) (format stream "FANCY") (call-next-method)))
4:55:23
ggole
That's probably a bit silly though, since if you wanted specific printing for foo you would just put it in the other arm of the if
6:27:21
emaczen
fiddlerwoaroof: I added some code to ensure execution in the main thread, but I still get the message from the OS saying that GNUstep is not responding. Any ideas?
6:30:06
emaczen
Well, perhaps my code does not ensure execution on the main thread, but regardless I've tried performSelectorOnMainThread:withObject:waitUntilDone: passing a NSWindow and the makeKeyAndOrderFront: selector as the arguments
7:16:23
emaczen
I just tried calling NSApplicationMain, and I don't get that OS warning anymore, but now my REPL thread is tied up
7:17:23
emaczen
No, I put something together using #/performSelectorOnMainThread:withObject:waitUntilDone:
7:22:12
emaczen
When you call my function #'execute-in-main-thread which takes a function as an argument, it redefines an objective-c method called #/runInMain that calls the function via a CFFI callback and then runs #/performSelectorOnMainThread:withObject:waitUntilDone: with an NSObject, the runInMain selector that was just defined, a null pointer and then I've tried yes and no for the last argument
7:23:42
emaczen
The function that I've been passing to #'execute-in-main-thread is typical objective-c code to create an autorelease pool, a NSApplication, and a Window
7:31:36
fiddlerwoaroof
Hmm, I'm not sure if that breaks the rule about calling into lisp from foreign threads
7:32:47
fiddlerwoaroof
"Direct calls to pthread_create (instead of MAKE-THREAD) create threads that SBCL is not aware of, these are called foreign threads. Currently, it is not possible to run Lisp code in such threads."
7:34:15
fiddlerwoaroof
I guess you're not directly calling that pthread function, but I'm a bit unsure if an objc selector that switches the thread a bit of code runs in has issues
7:38:06
emaczen
I'm going to try adding format forms to print sb-thread:*current-thread* and (sb-thread:main-thread)
8:12:47
Ukari
Josh_2, " jackdaniel: Ukari: atomic operations are in develop branch (not in 16.1.3 release)"