[Openmcl-devel] cannot call accessor from thread

Gary Byers gb at clozure.com
Thu Mar 21 02:10:58 PDT 2013



On Thu, 21 Mar 2013, Vijay Mathew wrote:

> I have the following class definition:
> 
> (defclass pool-executor ()
> ? ((max-workers :accessor max-workers :initarg :max-workers :initform nil)
> ?? (worker-pool :accessor worker-pool :initform nil)
> ?? (pending-requests :accessor pending-requests :initform nil)
> ?? (pending-requests-lock :reader pending-requests-lock :initform
> (create-lock "pending-requests-lock"))
> ?? (main-thread :accessor main-thread :initform nil)))
> 
> When I call the accessors from a thread, the following condition is raised:
> 
> 
> There is no applicable method for the generic function:
> ? #<STANDARD-GENERIC-FUNCTION FUTURES:PENDING-REQUESTS #x1890C216>
> when called with arguments:
> ? ((#<FUTURES:POOL-EXECUTOR #x18A58506>))
> ?? [Condition of type NO-APPLICABLE-METHOD-EXISTS]
> 
> 
> What could be going wrong here?

The error message is noting that #'FUTURES:PENDING-REQUESTS is being
called with one argument, a list of one element.  (If you prefer,
you could think of that one argumeny as being an instance of the built-in
class CONS, but it's only occasionally useful to think of it that way.)

As far as I know, the generic function has no methods that're applicable
to "instances of the built-in class CONS", so it signals an error.  You
probably didn't intend to call the generic function with a CONS, but may
have intended to call it with the instance that's in that CONS's CAR.

(Bill's observation that unexpected things can happen if you try to access
classes/generic functions/instances/... while they're being [re]defined is
certainly true, but it's not clear tnat it's relevant here.)

> 
> Thank you,
> 
> --Vijay
> 
>



More information about the Openmcl-devel mailing list